Here is a quick example:
import java.text.DecimalFormat;
class Format{
public static void main(String[] args){
String input = "12345678.2";
DecimalFormat formatter = new
DecimalFormat("#,###,###.00");
String s = formatter.format(
Double.parseDouble(input) );
System.out.println( s );
}
}