Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Java: Limits of Primitive Types

📅 2010-Apr-07 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ java ⬩ 📚 Archive

The maximum and minimum values of primitive number types in Java (Byte, Short, Integer, Long, Float, Double) can be obtained by reading the MAX_VALUE and MIN_VALUE of their classes.

For example:

int maxInt     = Integer.MAX_VALUE;
float minFloat = Float.MIN_VALUE;