Course Content
Core Java
About Lesson

It is a way of representing numbers using different symbols. Number System provides rules for writing and understanding numbers.

Base or Radix: It is the number of unique digits that a system of counting uses to represent numbers. A base can be any whole number greater than 0.

Number Systems supported in JAVA

  1. Decimal (Base 10)
  2. Binary (Base 2)
  3. Octal (Base 8)
  4. Hexadecimal (Base 16)

Decimal (Base 10)

Most commonly used in everyday life. Most mathematical operations, measurements, etc use it. Consist of 10 digits : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each digit’s position in a decimal number represents a power of 10. The rightmost digit represents 10^0 (1), the next represents 10^1 (10), the next 10^2 (100), and so on. For example, in the decimal number 123, the digit 3 represents 3×100, the digit 2 represents 2×101, and the digit 1 represents 1×102, resulting in the value 123.

Binary (Base 2)

The binary system uses only two digits: 0 and 1. Each digit’s position represents a power of 2. For example, in the binary number 101, the digit 1 represents 1 four (2 squared), the digit 0 represents 0 twos, and the digit 1 represents 1 one. Computers use binary numbers to represent data and perform computations. Binary is used as the language of machine instructions. Instructions and data in computer programs are stored and processed in binary format.

Octal (Base 8)

Octal system uses eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. Each digit’s position represents a power of 8. Octal was commonly used in early computer systems as a more compact representation of binary numbers. In Unix-like operating systems, octal numbers are used to represent file permissions. Each permission (read, write, execute) is represented by a digit in the octal number.

Hexadecimal (Base 16)

It provides more representation of binary data, making it easier for programmers to work with large binary numbers. They are used to represent memory addresses and locations in computer memory. Memory dumps and debugging output often use hexadecimal notation to display memory contents. Also used to represent colors in graphics and web design. It uses 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Each digit’s position represents a power of 16.

Scroll to Top