Description Of BigInteger: toString()
The java.math.BigInteger.toString() returns the decimal String representation of this BigInteger. 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) constructor, and allows for String concatenation with Java's + operator)BigInteger.toString() method returns decimal String representation of this BigInteger
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("1234");
BigInteger bi2 = new BigInteger("-1234");
System.out.println(bi1.toString()); // output 1234
System.out.println(bi2.toString()); // output -1234
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น