round To Decimals - Java java.lang

Java examples for java.lang:double Format

Description

round To Decimals

Demo Code


//package com.java2s;

public class Main {
    public static double roundToDecimals(double d, int c) {
        int temp = (int) ((d * Math.pow(10, c)));
        return (((double) temp) / Math.pow(10, c));
    }/* w w w .  jav  a2  s .  com*/
}

Related Tutorials