I\'d like to vary the precision of a double representation in a string I\'m formatting based on user input. Right now I\'m trying something like:
String foo
Why not :
String form = "%."+precision+"f\n"; String foo = String.format(form, my_double);
or :
public static String myFormat(String src, int precision, Object args...) { String form = "%."+precision+"f\n"; return String.format(form, args); }