1.0数组实现
package array;/** * 数组应用 面向过程编程 * * @author 杨伦亮 12:10:12 AM */public class ArrayApp {/** * @param args */public static void main(String[] args) {long[] arr = new long[100];int nElement = 0;int j; // loop countlong searchKey;// Key Item// insert 10 iteamsarr[0] = 77;arr[1] = 99;arr[2] = 44;arr[3] = 55;arr[4] = 22;arr[5] = 88;arr[6] = 11;arr[7] = 00;arr[8] = 66;arr[9] = 33;nElement = 10;// now 10 iteams in arrayfor (j = 0; j < nElement; j++) {System.out.print(arr[j] + "\t");}System.out.println();/* * Search */searchKey = 66;for (j = 0; j < nElement; j++) {if (arr[j] == searchKey) {break;}}if (j == nElement) {System.out.println("Can't find " + searchKey);} else {System.out.println("Found " + searchKey);}/* * delete Key */searchKey = 55;for (j = 0; j < nElement; j++) {if (arr[j] == searchKey) {break;}}for (int k = 0; k < nElement; k++) {arr[k] = arr[k + 1];}nElement--;/* * display */for (j = 0; j < nElement; j++) {System.out.print(arr[j] + "\t");}System.out.println();}}?