Here you can find the source of doubleToVisualString(double d)
Parameter | Description |
---|---|
d | the number to format |
public static String doubleToVisualString(double d)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { /**/*w ww.j a v a 2s .c o m*/ * Used to format doubles to two decimal places. (i.e. 2.23) * * @param d the number to format * @return the formatted number */ public static String doubleToVisualString(double d) { DecimalFormat decimalFormat = new DecimalFormat("#.##"); return decimalFormat.format(d); } }