Java Number Round roundUp(int groupSize, int globalSize)

Here you can find the source of roundUp(int groupSize, int globalSize)

Description

rounded up to the nearest multiple of the groupSize

License

Open Source License

Parameter

Parameter Description
groupSize a parameter
globalSize a parameter

Return

the rounded value

Declaration

public static int roundUp(int groupSize, int globalSize) 

Method Source Code

//package com.java2s;
/*//from w ww .j a v a 2s  . co m
 * Copyright (C) 2010-2014 Andreas Maier
 * CONRAD is developed as an Open Source project under the GNU General Public License (GPL).
*/

public class Main {
    /**
     * rounded up to the nearest multiple of the groupSize
     * @param groupSize
     * @param globalSize
     * @return the rounded value
     */
    public static int roundUp(int groupSize, int globalSize) {
        int r = globalSize % groupSize;
        if (r == 0) {
            return globalSize;
        } else {
            return globalSize + groupSize - r;
        }
    }
}

Related

  1. roundUp(final double val)
  2. roundUp(final int number, final int base)
  3. RoundUp(final T number)
  4. roundUp(int capacity)
  5. roundUp(int dividend, int divisor)
  6. roundUp(int groupSize, int globalSize)
  7. roundUp(int i, int snap)
  8. roundUp(int n, int nearestMultiple)
  9. roundUp(int ndigits)