Here you can find the source of toString(double in, String format)
public static String toString(double in, String format)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String toString(Object[] in) { StringBuffer desc = new StringBuffer(); desc.append("["); if (in != null) { for (int i = 0; i < in.length; i++) { desc.append(in[i]).append(";"); }//from w w w.ja va 2 s. c o m } desc.append("]"); return desc.toString(); } public static String toString(double in, String format) { DecimalFormat formatter = new DecimalFormat(format); return formatter.format(in); } public static String toString(int in, String format) { DecimalFormat formatter = new DecimalFormat(format); return formatter.format(in); } }