Google-polyline-codec is a project mainly written in Java, it's free.
Codec for the Google polyline algorithm