Here you can find the source of getIntRoundPercent(double f)
public static int getIntRoundPercent(double f)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static int getIntRoundPercent(double f) { DecimalFormat df = new DecimalFormat("#####"); Double.parseDouble(df.format(f)); return Integer.parseInt(df.format(f)); }//ww w. j a va 2s . co m public static Double parseDouble(String str) { try { DecimalFormat df = new DecimalFormat("#,##0.0#"); return Double.valueOf(String.valueOf(df.parseObject(str))); } catch (Exception e) { return new Double(0.0); } } }