Description Of BigInteger: signum()
The java.math.BigInteger.signum() returns the signum function of this BigIntegerBigInteger.signum() method returns -1, 0 or 1 as the value of this BigInteger is negative, zero or positive
Code Example Java BigInteger
import java.math.BigInteger; public class BigIntegerExam { public static void main(String[] args) { BigInteger bi1 = new BigInteger("0"); BigInteger bi2 = new BigInteger("10"); BigInteger bi3 = new BigInteger("-10"); // assign signum results of bi1, bi2, bi3 to i1, i2, i3 int i1 = bi1.signum(); int i2 = bi2.signum(); int i3 = bi3.signum(); // print i1, i2, i3 values System.out.println(i1); System.out.println(i2); System.out.println(i3); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น