What is the order of block hashes in block-locator array? I have to compose a "getblocks" command found in https://en.bitcoin.it/wiki/Protocol_specification#getblocks

The "getblocks" command contains the "block locator hashes". In essence, I inform a remote node of block hashes that I'm aware of already. There is a rule of how to construct the block locator. Except I’ve no idea of what “pushing”, “going back” or “newest back” means. I cannot figure out the order of block hashes in what I call a locatorArray.

Let’s assume I want to advertise three block hashes:


Block hash of block number zero.  
Block hash of block number one.  
Block hash of block number two.  


Let’s assume I have an array of three elements. For example, I might walk through the array in a for loop as follows:

for ( int i = 0; i &lt; locatorArrayLength; i++ )
{

}


The block hash of which block number should be in locatorArray[0]?
The block hash of which block number should be in locatorArray[2]?
The code on that wiki page is how Bitcoin Core constructs block locators, and it's a good method, but the method isn't enforced by the protocol. All you need to do is list a bunch of block hashes that you know about, ordered by descending block height. So in your example your locator could be (2,1,0), (2,1), (1), etc., but not (1, 2).