Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. array1.equals(array2)
  2.  
  3. public boolean equals(Object anObject) {
  4. if (this == anObject) {
  5. return true;
  6. }
  7. if (anObject instanceof String) {
  8. String anotherString = (String)anObject;
  9. int n = count;
  10. if (n == anotherString.count) {
  11. char v1[] = value;
  12. char v2[] = anotherString.value;
  13. int i = offset;
  14. int j = anotherString.offset;
  15. while (n-- != 0) {
  16. if (v1[i++] != v2[j++])
  17. return false;
  18. }
  19. return true;
  20. }
  21. }
  22. return false;
  23. }
  24.  
  25. public static boolean equals(long[] a, long[] a2) {
  26. if (a==a2)
  27. return true;
  28. if (a==null || a2==null)
  29. return false;
  30.  
  31. int length = a.length;
  32. if (a2.length != length)
  33. return false;
  34.  
  35. for (int i=0; i<length; i++)
  36. if (a[i] != a2[i])
  37. return false;
  38.  
  39. return true;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement