Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String next() {
- int start = page * pageLength;
- int end = start + pageLength;
- if (end >= text.length()) {
- end = text.length() - 1; // last character in the book
- } else {
- page = page + 1; // only turn the page if we are not at the end of
- // the book
- }
- if (start > text.length()) {
- return "end";
- }
- return text.substring(start, end);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement