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:





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable