Here you can find the source of Round(double a)
public static int Round(double a)
//package com.java2s; //License from project: Creative Commons License public class Main { /**//w w w. j a va 2s .c om * Floor if Value < 0.5, Ceil if Value >= 0.5 */ public static int Round(double a) { int tmp = ((int) (a * 100)) % 100; if (tmp < 50) { return Floor(a); } else { return Ceil(a); } } public static int Floor(double a) { return (int) Math.floor(a); } public static int Ceil(double a) { return (int) Math.ceil(a); } }