for( int a:array1){
if(a>=0){
System.out.println(a);
}
}
When you initialize the array, all index values set to 0, and you would 0 check.
As a different approach, you could use ArrayList
to insert values, which will save you from creating un wanted large array.