1 年
Questions & Answers
57
int[] array2 = new int[]{1,2,6,6,3,1,};
//method checks if the given array contents remain the same when array is reversed
public static boolean verify(int[] array, int index) {//method takes array and an index number
if ((array[index] == array[array.length - index-1]) && (index < array.length/2)) {
System.out.print("true/");
verify(array, ++index);// increase index number to check the next values in the th array
return true;
} else
System.out.println("..false..");
return false;
}
共 (0) 个答案