Here you can find the source of round(double d)
Parameter | Description |
---|---|
d | - the double to round |
public static int round(double d)
//package com.java2s; public class Main { /**/*from www . j av a 2 s . co m*/ * Round a double * * @param d - the double to round * @return - the rounded double as integer */ public static int round(double d) { int i = (int) d; double result = d - i; if (result < 0.5D) return i; return i + 1; } }