Java Number Round roundNumber(String n)

Here you can find the source of roundNumber(String n)

Description

round Number

License

LGPL

Declaration

private static String roundNumber(String n) 

Method Source Code

//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;
    }
}

Related

  1. roundNearest(double v, double target)
  2. roundNicely(double dbl)
  3. roundNumber(double rowNumber, int roundingPoint)
  4. roundNumber(double theNumber, int places)
  5. roundNumber(float input, float rounding)
  6. roundNumberTo(double value, int decimals)
  7. roundNumberToDouble(double value, int decimals)
  8. roundOff(double fraction, int precision)
  9. roundOffAmt(double dAmt)