Here you can find the source of roundToDimensions(int value, int nearestValue)
public static int roundToDimensions(int value, int nearestValue)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww .jav a2 s .c o m*/ * Round. */ public static int roundToDimensions(int value, int nearestValue) { return Math.round(value / nearestValue) * nearestValue; } }