This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Let's try to translate this from Java to English...
Before the first for-loop, you're creating an array a that can contain 5 ints. Then in the first for-loop, you're letting i start from zero, and it goes up to (but not including) the length of a (which is 5), so i goes from 0 to 4 (inclusive).
Inside the loop, you're assigning a value to the element with index i of the array a. The value you're assigning is a.length - i. We know that a.length is 5, so this is: 5 - i. Writing out the five iterations explicitly, this leads to:
Note that a remains unchanged, so a is still 1.
The content of the array is now [4, 3, 2, 1, 1] so that explains the first output.
It's similar for the third for-loop, with array b. Note that when you create a new int array, all its elements are initialized to 0. In the third for-loop you're assigning b[i - 1] to b[i], but since you've never set the elements of b to anything else than the default 0, the second output will be all zeroes.
You didn't post the code that produces the third line of output.