Here you can find the source of getTwoDecimalByDecimalFormat(double number)
public static String getTwoDecimalByDecimalFormat(double number)
//package com.java2s; //License from project: Open Source License public class Main { public static String getTwoDecimalByDecimalFormat(double number) { String decimal = ""; java.text.DecimalFormat df = new java.text.DecimalFormat("#.##"); decimal = df.format(number);/*from w w w .j a va 2s.c om*/ return decimal; } }