Java tutorial
//package com.java2s; public class Main { public static String formattedDouble(double d) { String dS = "" + d; return dS.length() > 6 ? dS.substring(0, 6) : dS; } }