Java BigDecimal areEqual(BigDecimal aThis, BigDecimal aThat)

Here you can find the source of areEqual(BigDecimal aThis, BigDecimal aThat)

Description

are Equal

License

Open Source License

Declaration

static public boolean areEqual(BigDecimal aThis, BigDecimal aThat) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {
    static public boolean areEqual(boolean aThis, boolean aThat) {
        return aThis == aThat;
    }//from ww  w.j  a v  a2 s  . c  om

    static public boolean areEqual(char aThis, char aThat) {
        // System.out.println("char");
        return aThis == aThat;
    }

    static public boolean areEqual(long aThis, long aThat) {
        /*
         * Implementation Note Note that byte, short, and int are handled by
         * this method, through implicit conversion.
         */
        // System.out.println("long");
        return aThis == aThat;
    }

    static public boolean areEqual(float aThis, float aThat) {
        // System.out.println("float");
        return Float.floatToIntBits(aThis) == Float.floatToIntBits(aThat);
    }

    static public boolean areEqual(double aThis, double aThat) {
        // System.out.println("double");
        return Double.doubleToLongBits(aThis) == Double.doubleToLongBits(aThat);
    }

    static public boolean areEqual(BigDecimal aThis, BigDecimal aThat) {
        return aThis.setScale(2).equals(aThat.setScale(2));
    }

    /**
     * Possibly-null object field.
     * 
     * Includes type-safe enumerations and collections, but does not include
     * arrays. See class comment.
     */
    static public boolean areEqual(Object aThis, Object aThat) {
        // System.out.println("Object");
        return aThis == null ? aThat == null : aThis.equals(aThat);
    }
}

Related

  1. adjustCurrencyDecimalPoint(final BigDecimal value, final int decimal)
  2. areEqual(BigDecimal first, BigDecimal second)
  3. asArray(final BigDecimal... elements)
  4. average(BigDecimal... values)
  5. average(final BigDecimal... numbers)