Swap nodes in pairs, using java