Here you can find the source of decimalPointTwo(Float input)
public static String decimalPointTwo(Float input)
//package com.java2s; /*/*from w ww . j a v a 2s .c o m*/ * CommonUtil.java * * Copyright 2007 NHN Corp. All rights Reserved. * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.math.RoundingMode; import java.text.DecimalFormat; public class Main { public static String decimalPointTwo(Float input) { if (input == null || input == 0) { return "0.0"; } DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.FLOOR); return df.format(input); } public static String decimalPointTwo(Double input) { if (input == null || input == 0) { return "0.0"; } DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.FLOOR); return df.format(input); } }