Here you can find the source of roundToInt(final double d)
final public static int roundToInt(final double d)
//package com.java2s; // License as published by the Free Software Foundation; either public class Main { /**//from w ww . j ava 2s.c o m * Rounds d to an int. */ final public static int roundToInt(final double d) { return (int) (d + 0.5); } final public static int roundToInt(final float f) { return (int) (f + 0.5f); } }