Java BigDecimal.hashCode()
Syntax
BigDecimal.hashCode() has the following syntax.
public int hashCode()
Example
In the following code shows how to use BigDecimal.hashCode() method.
// w w w .java 2s . co m
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) {
BigDecimal bg1 = new BigDecimal("123");
BigDecimal bg2 = new BigDecimal("123.50");
BigDecimal bg3 = new BigDecimal("123.80");
int i1 = bg1.hashCode();
int i2 = bg2.hashCode();
int i3 = bg3.hashCode();
System.out.println(i1);
System.out.println(i2);
System.out.println(i3);
}
}
The code above generates the following result.