
com.joanzapata.pdfview.util.NumberUtils Maven / Gradle / Ivy
/**
* Copyright 2013 Joan Zapata
*
* This file is part of Android-pdfview.
*
* Android-pdfview is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Android-pdfview is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Android-pdfview. If not, see .
*/
package com.joanzapata.pdfview.util;
public class NumberUtils {
private NumberUtils() {
// Prevents instantiation
}
/**
* Limits the given number between the other values
* @param number The number to limit.
* @param between The smallest value the number can take.
* @param and The biggest value the number can take.
* @return The limited number.
*/
public static int limit(int number, int between, int and) {
if (number <= between) {
return between;
}
if (number >= and) {
return and;
}
return number;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy