Math.max(total / 16, 1)但是一定要针对业务的数据量来考虑,如果数据量超过Integer,就不要这么写了。
建议使用BigInteger封装类。
BigInteger算page:
BigInteger totalCount = new BigInteger("10000000000000000000"); System.out.println(totalCount.divide(BigInteger.valueOf(16)).max(BigInteger.valueOf(1)));