19
Mar 10
Java: Bin/Dec/Hex Conversion and Primitive Data Types
Conversion Table
HEX | DECIMAL | BINARY |
0 | 0 = 0+0+0+0 | 0000 |
1 | 1 = 0+0+0+1 | 0001 |
2 | 2 = 0+0+2+0 | 0010 |
3 | 3 = 0+0+2+1 | 0011 |
4 | 4 = 0+2+0+0 | 0100 |
5 | 5 = 0+4+0+1 | 0101 |
6 | 6 = 0+4+2+0 | 0110 |
7 | 7 = 0+4+2+1 | 0111 |
8 | 8 = 8+0+0+0 | 1000 |
9 | 9 = 8+0+0+1 | 1001 |
A | 10 = 8+0+2+0 | 1010 |
B | 11 = 8+0+0+1 | 1011 |
C | 12 = 8+4+0+0 | 1100 |
D | 13 = 8+4+0+1 | 1101 |
E | 14 = 8+4+2+0 | 1110 |
F | 15 = 8+4+2+1 | 1111 |
Data Types and Data Structures
Primitive Type | Size | Minimum Value | Maximum Value |
char | 16-bit | Unicode 0 | Unicode 216-1 |
byte | 8-bit | -128 | +127 |
short | 16-bit | -215 (-32,768) |
+215-1 (32,767) |
int | 32-bit | -231 (-2,147,483,648) |
+231-1 (2,147,483,647) |
long | 64-bit | -263 (-9,223,372,036,854,775,808) |
+263-1 (9,223,372,036,854,775,807) |
float | 32-bit | 32-bit IEEE 754 floating-point numbers | |
double | 64-bit | 64-bit IEEE 754 floating-point numbers | |
boolean | 1-bit | true or false | |
void | —– | —– | Void |
Leave a Reply
You must be logged in to post a comment.