Here you can find the source of roundTo(float number, int base)
public static float roundTo(float number, int base)
//package com.java2s; //License from project: Open Source License public class Main { public static float roundTo(float number, int base) { return Math.round(number * 10 * base) / (10f * base); }/*w w w. ja v a2 s . co m*/ }