@Test public void test8() { Integer a[] = {1, 2, 3, 4, 5, 4}; Integer b = FindNUmber(a); System.out.println(b); } private static Integer FindNUmber(Integer[] a) { Map map = new HashMap(); for (int i = 0; i < a.length; i++) { if (map.containsKey(a[i])) { continue; } map.put(a[i], a[i]); } return null; }