I have read that 

```
    for (int i1 : A) {
    }

```

is better than 

```
    for (int i1=0; i1 < A.length; i++) {
    }

```

but if I want to access index value in first one is there any mean or should I use the second one only.