Looking for a java utility. It is even better if you can tell me how to do it using geotools library.
It depends on your source format. If it's already split up into degrees (d), minutes (m), and seconds (s), your algorithm is:
(assuming d is can be positive or negative)
dd = Math.signum(d) * (Math.abs(d) + (m / 60.0) + (s / 3600.0));
If it's smooshed together into a string, the usual format is:
"ffffd.mmss"
So parse out using a regular expression or String.substring() to get m and s.
Converting back is:
d = (int)dd; // Truncate the decimals
t1 = (dd - d) * 60;
m = (int)t1;
s = (t1 - m) * 60;