Here you can find the source of roundToNearestK(float v, int k)
public static int roundToNearestK(float v, int k)
//package com.java2s; //License from project: Open Source License public class Main { public static int roundToNearestK(float v, int k) { return (int) (Math.round(v / k) * k); }/*from w ww . j a v a 2 s. co m*/ }