Java Byte.parseByte(String s,int radix)
Syntax
Byte.parseByte(String s, int radix) has the following syntax.
public static byte parseByte(String s, int radix) throws NumberFormatException
Example
In the following code shows how to use Byte.parseByte(String s, int radix) method.
Byte.parseByte(String s, int radix)
parses the string argument as a
signed byte in the radix specified by the second argument and returns a byte
value.
In the following code we convert string 10 based on radix 8.
public class Main {
public static void main(String[] args) {
//from w w w . ja v a 2 s .c o m
System.out.println("parse string to byte:"+Byte.parseByte("10", 8));
}
}
The output: