วันพุธที่ 8 ตุลาคม พ.ศ. 2557

java.math.BigInteger.toString(int radix)

Description Of BigInteger: toString(int radix)

The java.math.BigInteger.toString(int radix) returns the String representation of this BigInteger in the given radix. If the radix is outside the range from Character.MIN_RADIX to Character.MAX_RADIX inclusive, it will default to 10 (as is the case for Integer.toString ). The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. (This representation is compatible with the (String, int) constructor)

BigInteger.toString(int radix) method returns String representation of this BigInteger in the given radix

Code Example Java BigInteger

import java.math.BigInteger;

public class BigIntegerExam {
 public static void main(String[] args) {
  BigInteger bi1 = new BigInteger("16");
  BigInteger bi2 = new BigInteger("-16");

  System.out.println(bi1.toString(8));
  System.out.println(bi2.toString(2));
 }
}


yengo หรือ buzzcity

ไม่มีความคิดเห็น :

แสดงความคิดเห็น