Here you can find the source of round(double what, int howmuch)
Parameter | Description |
---|---|
what | a parameter |
howmuch | a parameter |
public static double round(double what, int howmuch)
//package com.java2s; public class Main { /**// w ww . j a va2 s .com * round * @param what * @param howmuch * @return double */ public static double round(double what, int howmuch) { return (double) ((int) (what * Math.pow(10, howmuch) + .5)) / Math.pow(10, howmuch); } }