java how to check number to element is in list code example Example: java arraylist contains string boolean ans = arr.contains("geeks");