Advertisement
Advertisement
| 01.22.2008 at 06:46PM PST, ID: 23103304 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: |
import java.applet.Applet;
import java.io.*;
import java.util.*;
public class test extends Applet {
public final static int ARRAY_SIZE = 2000;
int find(int[ ] A) {
int j;
for ( j = 0; j < ARRAY_SIZE; j++ ) {
if (A[j] < 0) {
return j;
}
}
return -1;
}
public static void main(String[] args){
int[] A = new int[ARRAY_SIZE];
for(int i = 0; i < A.length; i++){
A[i] = (int)Math.round(Math.random() * 99999);
A[0] = 39872;
A[1] = 51263;
A[2] = 132;
A[3] = 97832;
A[4] = 87213;
A[5] = 15236;
A[6] = 12345;
A[7] = 23778;
A[8] = 33333;
A[9] = 41424;
System.out.println("A[" + i + "] = " + A[i]);
System.out.println("First neg. interger in A is at index = " +find(A));
}
}
}
|