Here you can find the source of roundToAccuracy(float n, float i)
private static float roundToAccuracy(float n, float i)
//package com.java2s; //License from project: Open Source License public class Main { private static float roundToAccuracy(float n, float i) { int cutoffN = (int) (n / i); return cutoffN * i; }//from w w w . ja v a 2 s .com }