Java Integer Divide divideToCeil(int numerator, int denominator)

Here you can find the source of divideToCeil(int numerator, int denominator)

Description

Performs a division and rounds upwards to the next integer.

License

Open Source License

Parameter

Parameter Description
numerator the numerator.
denominator the denominator.

Return

an integer value.

Declaration

public static int divideToCeil(int numerator, int denominator) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* www.j a  v  a 2s.c  om*/
     * Performs a division and rounds upwards to the next integer.
     * 
     * @param numerator the numerator.
     * @param denominator the denominator.
     * @return an integer value.
     */
    public static int divideToCeil(int numerator, int denominator) {
        Double result = Math.ceil((double) numerator / denominator);

        return result.intValue();
    }
}

Related

  1. divideAndCeil(int dividend, int divisor)
  2. divideAndRound(int dividend, int divisor)
  3. divideAndRoundUp(long dividend, int divisor)
  4. divideRoundUp(int first, int second)
  5. divideStringWithInt(String strDividend, int divisor)
  6. divideToInt(String address)
  7. divideUnsigned(int dividend, int divisor)
  8. divideWithCeilingRoundingMode(int p, int q)
  9. divideWithoutOverflow(int x, int y)