Description Of BigDecimal: signum()
The java.math.BigDecimal.signum() returns the signum function of this BigDecimal .BigDecimal.signum() method returns -1, 0, or 1 as the value of this BigDecimal is negative, zero, or positive.
Code Example Java BigDecimal
import java.math.BigDecimal; public class BigDecimalExam { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("555"); BigDecimal bg2 = new BigDecimal("0"); BigDecimal bg3 = new BigDecimal("-555"); int i1 = bg1.signum(); int i2 = bg2.signum(); int i3 = bg3.signum(); String str1 = "The Result of Signum function on " + bg1 + " is " + i1; String str2 = "The Result of Signum function on " + bg2 + " is " + i2; String str3 = "The Result of Signum function on " + bg3 + " is " + i3; // print i1,i2,i3 values System.out.println(str1); System.out.println(str2); System.out.println(str3); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น