Here you can find the source of roundToBase(int a, int base)
public static int roundToBase(int a, int base)
//package com.java2s; //License from project: GNU General Public License public class Main { /** Returns the nearest number to a multiple of a given number. */ public static int roundToBase(int a, int base) { return a - a % base; }/* ww w.j av a 2 s . c o m*/ }