Naw, never mind.
Performance The performance loss due to Stringstring manipulation is zero.
And here's the code to trim the end after %f:
private static String trimTrailingZeros(String number) { if(!number.contains(".")) { return number; } return number.replaceAll("\\.?0*$", ""); }