Here you can find the source of round_up(int value, int multiple)
Parameter | Description |
---|---|
value | the number to be rounded |
multiple | the number to which to be rounded |
int
greater than or equal to value
which divides multiple
exactly.
public static int round_up(int value, int multiple)
//package com.java2s; /*/*from w w w . j av a 2s.co m*/ * JGrass - Free Open Source Java GIS http://www.jgrass.org * (C) HydroloGIS - www.hydrologis.com * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Library General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more * details. * * You should have received a copy of the GNU Library General Public License * along with this library; if not, write to the Free Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ public class Main { /** * Round a number up to a given multiple. * * @param value the number to be rounded * @param multiple the number to which to be rounded * * @return the smallest <code>int</code> greater than or equal to * <code>value</code> which divides <code>multiple</code> exactly. */ public static int round_up(int value, int multiple) { return (((value - 1) / multiple) + 1) * multiple; } }