入力値チェックのためにbyte→longのように大きな器に移し替えることを
upcastと呼ぶ
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
/**
*
* @author java
*/
public class SampleProject {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
byte b = 100;
long l = b; //up cast
System.out.println(l);
if (l>Byte.MAX_VALUE || l<Byte.MIN_VALUE) {
System.out.println("max erro or min error");
}
}
}