divide integer And Round Up - Java java.lang

Java examples for java.lang:int

Description

divide integer And Round Up

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int a = 2;
        int b = 2;
        System.out.println(divAndRoundUp(a, b));
    }// ww  w . j  a va2  s.c o  m

    public static int divAndRoundUp(int a, int b) {
        return (a - 1) / b + 1;
    }
}

Related Tutorials