java bigdecimal compareto
package com.tutorialspoint;
import java.math.*;
public class BigDecimalDemo {
public static void main(String[] args) {
// create 2 BigDecimal objects
BigDecimal bg1, bg2;
bg1 = new BigDecimal("10");
bg2 = new BigDecimal("20");
//create int object
int res;
res = bg1.compareTo(bg2); // compare bg1 with bg2
String str1 = "Both values are equal ";
String str2 = "First Value is greater ";
String str3 = "Second value is greater";
if( res == 0 )
System.out.println( str1 );
else if( res == 1 )
System.out.println( str2 );
else if( res == -1 )
System.out.println( str3 );
}
}
Also in Java:
- java exit
- set java
- islowercase java
- how to create gravity in java
- system.arraycopy java
- java string regexp replace
- java concatenate strings
- java convert a set to array
- recursive function for fibonacci series in java javascript
- bukkit java get max players
- string to double java
- how to create a thread local variable in java
- how to count an replace string in java
- floor in java
- java how to get all threads
- classes in java
- java print treemap
- check last character of string java
- java hashmap put
- java override equals and hashcode
- Enums injava
- java sum of two numbers program intellij
- arrays.aslist.add
- java stack