Here you can find the source of toInt(double f)
public static int toInt(double f)
//package com.java2s; //License from project: Open Source License public class Main { /** Convert a double into an int */ public static int toInt(double f) { return (f - (double) ((int) f) < 0.5) ? (int) f : (int) f + 1; }// w w w . ja v a 2 s.c o m }