Format Specifier of byte in Java

1.6k views Asked by At

What's the format specifier of byte in Java?

For example,

%d=int

%s=short

%f=float 
1

There are 1 answers

0
Thilo On

You could use %d for decimal output (works for all integer types, not just int), but this will print the signed value (such as -100), which can be unexpected for a byte.

You can also use %x for hexadecimal.