From what I see you just try to see if they are equal, if this is true
, just go with something like this:
boolean areEqual = Arrays.equals(arr1, arr2);
This is the standard way of doing it.
Please note that the arrays must be also sorted to be considered equal, from the JavaDoc:
Two arrays are considered equal if both arrays contain the same number
of elements, and all corresponding pairs of elements in the two arrays
are equal. In other words, two arrays are equal if they contain the
same elements in the same order.
Sorry for missing that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…