Getting unexpected return value when appending to array

Thank you, this worked like a charm. Do you have any idea besides shady black magic, why Java might do this?