Java ASCII Table
ASCII stands for American Standard Code for Information Interchange. ASCII is a standard data-transmission code that is used by the computer for representing both the textual data and control characters.
ASCII is a 7-bit character set having 128 characters, i.e., from 0 to 127. ASCII represents a numeric value for each character, such as 65 is a value of A. In our Java program, we need to manipulate characters that are stored in ASCII.
In Java, an ASCII table is a table that defines ASCII values for each character. It is also a small subset of Unicode because it contains 2 bytes while ASCII requires only one byte.
ASCII Value | Decimal Value | Hex value |
---|---|---|
Control | 0 | 0 |
Control | 1 | 1 |
Control | 2 | 2 |
Control | 3 | 3 |
Control | 4 | 4 |
Control | 5 | 5 |
Control | 6 | 6 |
Control | 7 | 7 |
Control | 8 | 8 |
t | 9 | 9 |
n | 10 | A |
Whitespace | 11 | B |
f | 12 | C |
r | 13 | D |
Control | 14 | E |
Control | 14 | F |
Control | 16 | 10 |
Control | 17 | 11 |
Control | 18 | 12 |
Control | 19 | 13 |
Control | 20 | 14 |
Control | 21 | 15 |
Control | 22 | 16 |
Control | 23 | 17 |
Control | 24 | 18 |
Control | 25 | 19 |
Control | 26 | 1a |
Control | 27 | 1b |
Whitespace | 28 | 1c |
Whitespace | 29 | 1d |
Whitespace | 30 | 1e |
Whitespace | 31 | 1f |
space | 32 | 20 |
! | 33 | 21 |
“ | 34 | 22 |
# | 35 | 23 |
$ | 36 | 24 |
% | 37 | 25 |
& | 38 | 26 |
‘ | 39 | 27 |
( | 40 | 28 |
) | 41 | 29 |
* | 42 | 2a |
+ | 43 | 2b |
, | 44 | 2c |
– | 45 | 2d |
. | 46 | 2e |
/ | 47 | 2f |
0 | 48 | 30 |
1 | 49 | 31 |
2 | 50 | 32 |
3 | 51 | 33 |
4 | 52 | 34 |
5 | 53 | 35 |
6 | 54 | 36 |
7 | 55 | 37 |
8 | 56 | 38 |
9 | 57 | 39 |
: | 58 | 3a |
; | 59 | 3b |
< | 60 | 3c |
= | 61 | 3d |
> | 62 | 3e |
? | 63 | 3f |
@ | 64 | 40 |
A | 65 | 41 |
B | 66 | 42 |
C | 67 | 43 |
D | 68 | 44 |
E | 69 | 45 |
F | 70 | 46 |
G | 71 | 47 |
H | 72 | 48 |
I | 73 | 49 |
J | 74 | 4a |
K | 75 | 4b |
L | 76 | 4c |
M | 77 | 4d |
N | 78 | 4e |
O | 79 | 4f |
P | 80 | 50 |
Q | 81 | 51 |
R | 82 | 52 |
S | 83 | 53 |
T | 84 | 54 |
U | 85 | 55 |
V | 86 | 56 |
W | 87 | 57 |
X | 88 | 58 |
Y | 89 | 59 |
Z | 90 | 5a |
[ | 91 | 5b |
92 | 5c | |
] | 93 | 5d |
^ | 94 | 5e |
_ | 95 | 5f |
` | 96 | 60 |
a | 97 | 61 |
b | 98 | 62 |
c | 99 | 63 |
d | 100 | 64 |
e | 101 | 65 |
f | 102 | 66 |
g | 103 | 67 |
h | 104 | 68 |
i | 105 | 69 |
j | 106 | 6a |
k | 107 | 6b |
l | 108 | 6c |
m | 109 | 6d |
n | 110 | 6e |
o | 111 | 6f |
p | 112 | 70 |
q | 113 | 71 |
r | 114 | 72 |
s | 115 | 73 |
t | 116 | 74 |
u | 117 | 75 |
v | 118 | 76 |
w | 119 | 77 |
x | 120 | 78 |
y | 121 | 79 |
z | 122 | 7a |
{ | 123 | 7b |
| | 124 | 7c |
} | 125 | 7d |
~ | 126 | 7e |
control | 127 | 7f |
Let’s create a Java program for constructing the above ASCII table. In the Java program, we use the isWhitespace() method of the character for determining whether a character is a whitespace or not. We also use the built-in method IsISOControl() method for detecting characters that are not letters, digits and punctuation.
ASCIITable.java
Output: