How to find out if part of an array is empty
Say we have a simple array like this:
class test{
public static void main(String[] args){
int arr[] = new int[10];
for(int i=0;i<4;i++){
arr[i] = i;
}
for(int j=0;j<arr.length;j++){
System.out.println(arr[j]);
}
}
}
where the array has only a few parts of it given values. Is there any way to know in a sort of test what parts of the array are empty.
Because when I run this is cmd, i get 0 in each of the empty parts but I'm thinking also from that program position 0 also contains "0" as was done in the for loop.
thanks in advance