Java examples for java.math:BigInteger
Checks if two BigInteger arrays contain the same entries
//package com.java2s; import java.math.BigInteger; public class Main { /**// w w w .j av a2 s . c o m * Checks if two BigInteger arrays contain the same entries * * @param a * first BigInteger array * @param b * second BigInteger array * @return true or false */ public static boolean equals(BigInteger[] a, BigInteger[] b) { int flag = 0; if (a.length != b.length) { return false; } for (int i = 0; i < a.length; i++) { // avoid branches here! // problem: compareTo on BigIntegers is not // guaranteed constant-time! flag |= a[i].compareTo(b[i]); } return flag == 0; } }