IT. Expert System.

Java basics

forDigit()


The java.lang.Character.forDigit(int digit, int radix) determines the character representation for a specific digit in the specified radix. If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned. The radix argument is valid if it is greater than or equal to MIN_RADIX and less than or equal to MAX_RADIX. The digit argument is valid if 0 ≤ digit < radix. if the digit is less than 10, then '0' + digit is returned. otherwise, the value 'a' + digit − 10 is returned.

Syntax:
public static char forDigit(int digit, int radix)


Example:

import java.lang.*;

public class CharacterDemo {

   public static void main(String[] args) {

      // create 2 character primitives ch1, ch2
      char ch1, ch2;

      // create 2 int primitives i1, i2 and assign values
      int i1 = 3;
      int i2 = 14;

      // assign char representation of i1, i2 to ch1, ch2 using radix
      ch1 = Character.forDigit(i1, 10);
      ch2 = Character.forDigit(i2, 16);

      String str1 = "Char representation of " + i1 + " in radix 10 is " + ch1;
      String str2 = "Char representation of " + i2 + " in radix 16 is " + ch2;

      // print ch1, ch2 values
      System.out.println( str1 );
      System.out.println( str2 );
   }
}


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: 91 / 158781130. Delta: 0.00159 с