Here you can find the source of compareTo(BigDecimal b1, BigDecimal b2)
Parameter | Description |
---|---|
b1 | <code>java.math.BigDecimal</code> |
b2 | <code>java.math.BigDecimal</code> |
public static int compareTo(BigDecimal b1, BigDecimal b2)
//package com.java2s; /*// ww w . j av a2s.c o m * File: $RCSfile$ * * Copyright (c) 2005 Wincor Nixdorf International GmbH, * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany * All Rights Reserved. * * This software is the confidential and proprietary information * of Wincor Nixdorf ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered * into with Wincor Nixdorf. */ import java.math.BigDecimal; public class Main { public static final BigDecimal ZERO = new BigDecimal((double) 0); /** * Compare to b1 with b2 * * @param b1 <code>java.math.BigDecimal</code> * @param b2 <code>java.math.BigDecimal</code> * @return if b1 and b2 ==null return 0, else @see java.math.BigDecimal#compareTo */ public static int compareTo(BigDecimal b1, BigDecimal b2) { if (b1 == null && b2 == null) { return 0; } if (b1 == null) { b1 = ZERO; } if (b2 == null) { b2 = ZERO; } return b1.compareTo(b2); } }