Get Size, Minimum and Maximum Value of Data Types in Java

This example will provide how to get size, minimum, and maximum value of data types in java

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		System.out.println("1. Byte");
		System.out.println("Size: " + Byte.SIZE);
		System.out.println("Min Value: " + Byte.MIN_VALUE);
		System.out.println("Max Value: " + Byte.MAX_VALUE);
		
		System.out.println("\n2. Short");
		System.out.println("Size: " + Short.SIZE);
		System.out.println("Min Value: " + Short.MIN_VALUE);
		System.out.println("Max Value: " + Short.MAX_VALUE);
		
		System.out.println("\n3. Integer");
		System.out.println("Size: " + Integer.SIZE);
		System.out.println("Min Value: " + Integer.MIN_VALUE);
		System.out.println("Max Value: " + Integer.MAX_VALUE);
				
		System.out.println("\n4. Long");
		System.out.println("Size: " + Long.SIZE);
		System.out.println("Min Value: " + Long.MIN_VALUE);
		System.out.println("Max Value: " + Long.MAX_VALUE);
		
		System.out.println("\n5. Float");
		System.out.println("Size: " + Float.SIZE);
		System.out.println("Min Value: " + Float.MIN_VALUE);
		System.out.println("Max Value: " + Float.MAX_VALUE);
		
		System.out.println("\n6. Double");
		System.out.println("Size: " + Double.SIZE);
		System.out.println("Min Value: " + Double.MIN_VALUE);
		System.out.println("Max Value: " + Double.MAX_VALUE);
		
		System.out.println("\n7. Character");
		System.out.println("Size: " + Character.SIZE);
	}

}
1. Byte
Size: 8
Min Value: -128
Max Value: 127

2. Short
Size: 16
Min Value: -32768
Max Value: 32767

3. Integer
Size: 32
Min Value: -2147483648
Max Value: 2147483647

4. Long
Size: 64
Min Value: -9223372036854775808
Max Value: 9223372036854775807

5. Float
Size: 32
Min Value: 1.4E-45
Max Value: 3.4028235E38

6. Double
Size: 64
Min Value: 4.9E-324
Max Value: 1.7976931348623157E308

7. Character
Size: 16