Java Number Round round(int t, int n, int decimals)

Here you can find the source of round(int t, int n, int decimals)

Description

round

License

Open Source License

Declaration

public static double round(int t, int n, int decimals) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double round(int t, int n, int decimals) {
        double exp = Math.pow(10, decimals);
        return Math.round(exp * t / n) / exp;
    }/*from w w w .  j  a  va  2s . co m*/

    public static double round(double d, int decimals) {
        double exp = Math.pow(10, decimals);
        return Math.round(exp * d) / exp;
    }
}

Related

  1. round(final long timeMs, final int precision)
  2. round(int a, int cutOfDigits)
  3. round(int f)
  4. round(int n)
  5. round(int start, int boundary)
  6. round(int top, int div2, int divisor)
  7. round(int x, int quantum)
  8. round(Integer a)
  9. round(Number number, Number unit)