Here you can find the source of roundNumber(String n)
private static String roundNumber(String n)
//package com.java2s; //License from project: LGPL public class Main { private static String roundNumber(String n) { String res = n;//from w ww .ja va2 s . co m if (n != null) { double dbl = Double.parseDouble(n); double d = Math.round(dbl * Math.pow(10, 3.0)) / Math.pow(10, 3.0); res = Double.toString(d); } return res; } }