Minimum and maximum values of a byte
To get the range of a byte value, use the wrapper class Byte and get the value of its static variables MIN_VALUE and MAX_VALUE. The output of the code below is: -128 127 |
/** * * @author javadb.com */ public class Main { /** * Example method for getting the range of a byte */ public void getByteRange() { System.out.println(Byte.MIN_VALUE); System.out.println(Byte.MAX_VALUE); } /** * @param args the command line arguments */ public static void main(String[] args) { new Main().getByteRange(); } } |
Search for code examples on this site
