Here you can find the source of floatToInt(float f)
public static final int floatToInt(float f)
//package com.java2s; //License from project: Open Source License public class Main { public static final int floatToInt(float f) { int i = Math.round(f * 255); return (i > 255) ? 255 : i; }/*from w w w .j a v a 2 s .c o m*/ }