Here you can find the source of round(float x)
static public int round(float x)
//package com.java2s; //License from project: Apache License public class Main { static private final int BIG_ENOUGH_INT = 16 * 1024; static private final double BIG_ENOUGH_ROUND = BIG_ENOUGH_INT + 0.5f; /**/*from w ww . j a va2s. co m*/ * Returns the closest integer to the specified float. This method will only * properly round floats from -(2^14) to (Float.MAX_VALUE - 2^14). */ static public int round(float x) { return (int) (x + BIG_ENOUGH_ROUND) - BIG_ENOUGH_INT; } }