Here you can find the source of contains(T[] array, T value)
public static <T> boolean contains(T[] array, T value)
//package com.java2s; public class Main { public static boolean contains(int[] array, int value) { for (int element : array) { if (element == value) { return true; }//from w ww. j a v a2 s . c om } return false; } public static <T> boolean contains(T[] array, T value) { for (T element : array) { if (element == null) { if (value == null) { return true; } } else { if (value != null && element.equals(value)) { return true; } } } return false; } public static boolean equals(byte[] array1, byte[] array2, int length) { if (array1 == array2) { return true; } if (array1 == null || array2 == null || array1.length < length || array2.length < length) { return false; } for (int i = 0; i < length; i++) { if (array1[i] != array2[i]) { return false; } } return true; } }