Here you can find the source of floatToInteger(float f, float f2, float offset, boolean rotate)
private static int floatToInteger(float f, float f2, float offset, boolean rotate)
//package com.java2s; public class Main { private static int floatToInteger(float f, float f2, float offset, boolean rotate) { if (rotate) { int i = (int) ((f2 - f) * 2 * offset); if (i > offset) { return i - (int) (2 * offset); } else if (i < -offset) { return i + (int) (2 * offset); } else { return i; }// w w w . j a v a 2 s . c o m } else { if (f != 0.0f) { return (int) ((f2 - f) * offset / f); } else { return (int) ((f2 - f) * offset); } } } }