All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.paganini2008.devtools.NumberRange Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package com.github.paganini2008.devtools;

import java.math.BigInteger;

/**
 * NumberRange
 * 
 * @author Fred Feng
 * @version 1.0
 */
public abstract class NumberRange {

	private static final BigInteger MIN_BYTE = BigInteger.valueOf(Byte.MIN_VALUE);
	private static final BigInteger MAX_BYTE = BigInteger.valueOf(Byte.MAX_VALUE);
	private static final BigInteger MIN_SHORT = BigInteger.valueOf(Short.MIN_VALUE);
	private static final BigInteger MAX_SHORT = BigInteger.valueOf(Short.MAX_VALUE);
	private static final BigInteger MIN_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE);
	private static final BigInteger MAX_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE);
	private static final BigInteger MIN_LONG = BigInteger.valueOf(Long.MIN_VALUE);
	private static final BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE);

	public static boolean checkByte(BigInteger value) {
		return CompareUtils.between(value, MIN_BYTE, MAX_BYTE);
	}

	public static boolean checkShort(BigInteger value) {
		return CompareUtils.between(value, MIN_SHORT, MAX_SHORT);
	}

	public static boolean checkInteger(BigInteger value) {
		return CompareUtils.between(value, MIN_INTEGER, MAX_INTEGER);
	}

	public static boolean checkLong(BigInteger value) {
		return CompareUtils.between(value, MIN_LONG, MAX_LONG);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy