There is no guarantee that the generated IDs in R will be sequential, or that they will be generated in any particular order.
I recommend putting your IDs in an array resource like so:
<array name="button_id_array">
<item>@id/button00</item>
<item>@id/button01</item>
<item>@id/button02</item>
</array>
Then you can access it in code like so:
int[] ids = getResources().getIntArray(R.array.test);