Test whether two byte arrays (Java byte arrays not Pig byte arrays) are equal. I have no idea why we have this function. @param lhs byte array 1 @param rhs byte array 2 @return true if both are null or the two are the same length and have the same bytes.
(byte[] lhs, byte[] rhs)
| 1632 | * the same bytes. |
| 1633 | */ |
| 1634 | public static boolean equalByteArrays(byte[] lhs, byte[] rhs) { |
| 1635 | if(lhs == null && rhs == null) { |
| 1636 | return true; |
| 1637 | } |
| 1638 | if(lhs == null || rhs == null) { |
| 1639 | return false; |
| 1640 | } |
| 1641 | if(lhs.length != rhs.length) { |
| 1642 | return false; |
| 1643 | } |
| 1644 | for(int i = 0; i < lhs.length; ++i) { |
| 1645 | if(lhs[i] != rhs[i]) { |
| 1646 | return false; |
| 1647 | } |
| 1648 | } |
| 1649 | return true; |
| 1650 | } |
| 1651 | |
| 1652 | |
| 1653 | /** |
no outgoing calls