Java Integer Divide divCeil(int nNumerator, int nDenominator)

Here you can find the source of divCeil(int nNumerator, int nDenominator)

Description

Returns ceil (nNumerator / nDenominator).

License

Open Source License

Parameter

Parameter Description
nNumerator The numerator
nDenominator The denomiator

Return

ceil (nNumerator / nDenominator)

Declaration

public static int divCeil(int nNumerator, int nDenominator) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * /*from  w ww.  j a va  2 s.  co  m*/
 * Contributors:
 *     Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
 ******************************************************************************/

public class Main {
    /**
     * Returns
     * <code>ceil (<var>nNumerator</var> / <var>nDenominator</var>)</code>.
     * 
     * @param nNumerator
     *            The numerator
     * @param nDenominator
     *            The denomiator
     * @return <code>ceil (<var>nNumerator</var> / <var>nDenominator</var>)</code>
     */
    public static int divCeil(int nNumerator, int nDenominator) {
        return (nNumerator + nDenominator - 1) / nDenominator;
    }
}

Related

  1. div(int val, int coe)
  2. divce(long size, long divider, int i)
  3. divCeil(int a, int b)
  4. divCeil(int a, int b)
  5. divCeil(int a, int b)
  6. divCeil(int pNum, int pDivisor)
  7. divCeil(int value, int divisor)
  8. divData(int numTest, int numTrain)
  9. dividable(final String charBitmap, final int row)