Java BigInteger Calculate areEqual(BigInteger[] a, BigInteger[] b)

Here you can find the source of areEqual(BigInteger[] a, BigInteger[] b)

Description

are Equal

License

Apache License

Declaration

public static boolean areEqual(BigInteger[] a, BigInteger[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigInteger;

public class Main {
    public static boolean areEqual(boolean[] a, boolean[] b) {
        if (a == b) {
            return true;
        }//www  .  j ava 2  s.co m

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(char[] a, char[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(byte[] a, byte[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(int[] a, int[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(long[] a, long[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(BigInteger[] a, BigInteger[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (!a[i].equals(b[i])) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. base128(BigInteger val)
  2. base62Encode(BigInteger number)
  3. bitArrayToUnsignedBigInteger(int[] bits)
  4. bitcoinValueToFriendlyString(BigInteger value)