Java Decimal decimalPlaces(double value, int precision)

Here you can find the source of decimalPlaces(double value, int precision)

Description

decimal Places

License

Apache License

Declaration

public static double decimalPlaces(double value, int precision) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double decimalPlaces(double value, int precision) {
        return (double) Math.round(value * Math.pow(10.0D, (double) precision))
                / Math.pow(10.0D, (double) precision);
    }//from  w w  w . ja  va 2s  . c o  m
}

Related

  1. decimalDump(final byte[] bytes)
  2. decimalPart(float f)
  3. decimalPart(float number)
  4. decimalPlace(float theValue, int theDecimalPlaces)
  5. decimalPlaces(double value, int precision)
  6. decimalRound(double value, int roundPlaces)
  7. decimalScale(double value, double max)
  8. decimalScaleTime(int value, int max)
  9. decimalScalingBase(double value)