Reverse Nodes in k-Group in Java