Here you can find the source of arrayContains(int[] arr, int e)
Parameter | Description |
---|---|
arr | the int array |
e | the element |
public static boolean arrayContains(int[] arr, int e)
//package com.java2s; public class Main { /**/*from w ww . java2 s . co m*/ * checks if an int array contains an int element * * @param arr the int array * @param e the element * @return boolean true or false */ public static boolean arrayContains(int[] arr, int e) { for (int i = 0; i < arr.length; i++) { if (arr[i] == e) return true; } return false; } }