I have to convert a function from PHP to Java, and can use some clarification on PHP's array syntax, which has a few differences from Java. The PHP code is
$W; //array defined before and has values
$S = array();
$j = wsnum - 1; //integer value here
for ( ; ; ){
$S[] = $j
$S[] = $W[$j];
}
My interpretation of this snippet is
$S
is initialized as an array of length 0$j
is pushed to$S[0]
- The contents of
$W[$j]
are pushed to$S[1]
Is my interpretation correct, or am I barking up the wrong tree?