Here you can find the source of doubleToI18nString(double d)
public static String doubleToI18nString(double d)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 Boeing.//from www. j a va2s .co m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Boeing - initial API and implementation *******************************************************************************/ public class Main { public static String doubleToI18nString(double d) { return doubleToI18nString(d, false); } public static String doubleToI18nString(double d, boolean blankIfZero) { if (blankIfZero && d == 0) { return ""; } // This enables java to use same string for all 0 cases instead of creating new one else if (d == 0) { return "0.00"; } else { return String.format("%4.2f", d); } } }