int

int is a signed 32-bit type that has a range from -2,147,483,648 to 2,147,483,647.

When byte and short values are used in an expression they are promoted to int when the expression is evaluated.

octal (base eight)

Octal values are denoted in Java by a leading zero. valid value 09 will produce an error from the compiler, since 9 is outside of octal's 0 to 7 range.


public class Main {

  public static void main(String[] args) {
    int i = 010;

    System.out.println(i);
  }
}

The output:


8

hexadecimal (base 16).

hexadecimal matches with modulo 8 word sizes, such as 8, 16, 32, and 64 bits. You signify a hexadecimal constant with a leading zero-x, (0x or 0X).

The range of a hexadecimal digit is 0 to 15, so A through F (or a through f ) are substituted for 10 through 15.

An integer literal can always be assigned to a long variable. An integer can also be assigned to a char as long as it is within range.


public class Main{
  public static void main(String[] argv){
    int f = 0XFFFFF;

    System.out.println(f);//1048575
    
  }
}
Home 
  Java Book 
    Language Basics  

Primitive Types:
  1. The Primitive Types
  2. byte
  3. short
  4. int
  5. long
  6. float
  7. double
  8. char
  9. boolean