我想知道是否有更好的方法为这个并传递Array给该方法或每次我想检查一个数字是否在其中时写出来array.
例如:
public static boolean inArray(int[] array, int check) {
for (int i = 0; i < array.length; i++) {
if (array[i] == check)
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
我在这里先向您的帮助表示感谢!