Convert String to byte

This example shows how to convert a String to a byte.
The String can only contain digits (or start with the – sign) and the number has to be within the byte range, otherwise a NumberFormatException will be thrown.

The output from the code below is:

Tried to convert an invalid value

Where you looking to convert String to byte array?

Search for more Java info on this site here:
Custom Search

Any thoughts or questions?