IT. Expert System.

Java basics

parseByte()


It parses the string argument as a signed byte in the radix specified by the second argument.

Syntax:
Library:  java.lang.Byte

public static byte parseByte(String s, int radix) throws NumberFormatException


Example:

import java.lang.*;

public class ByteDemo {

   public static void main(String[] args) {

      // create 2 byte primitives bt1, bt2
      byte bt1, bt2;

      // create and assign values to String's s1, s2
      String s1 = "123";
      String s2 = "-1a";

      // create and assign values to int r1, r2
      int r1 = 8;  // represents octal
      int r2 = 16; // represents hexadecimal

      /**
       *  static method is called using class name. Assign parseByte
       *  result on s1, s2 to bt1, bt2 using radix r1, r2
       */
      bt1 = Byte.parseByte(s1, r1);
      bt2 = Byte.parseByte(s2, r2);

      String str1 = "Parse byte value of " + s1 + " is " + bt1;
      String str2 = "Parse byte value of " + s2 + " is " + bt2;

      // print bt1, bt2 values
      System.out.println( str1 );
      System.out.println( str2 );
   }
}

Output:

Parse byte value of 123 is 83
Parse byte value of -1a is -26


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 342 / 158862828. Delta: 0.00319 с