向上取整Math.ceil()

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ZHOU_VIP/article/details/82820538
public class test {
	
	public static void main(String[] args) {
		int count = 121;
		int pagesize = 10;
		double a = count/(double)pagesize;
		System.out.println("a="+a);
		int b = (int) Math.ceil(a);
		System.out.println(b);
	}

}

a=12.1
13

猜你喜欢

转载自blog.csdn.net/ZHOU_VIP/article/details/82820538