get Total Page Number from total row - Java java.lang

Java examples for java.lang:Math Number

Description

get Total Page Number from total row

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        long totalRow = 2;
        System.out.println(getTotalPageNumber(totalRow));
    }//from  ww  w  . ja  va2 s  . co  m

    public static final int pageSpeed = 50;

    public static long getTotalPageNumber(long totalRow) {
        long pageTotal = 1;
        if (totalRow > pageSpeed) {
            long y = totalRow % pageSpeed;
            pageTotal = totalRow / pageSpeed;
            if (0 != y) {
                pageTotal = pageTotal + 1;
            }
        }

        return pageTotal;
    }
}

Related Tutorials