public static void main(String[] args) { String[] data = new String[] {"1", "2", "3", "4", "5", "6"}; Node head = new Node(data[0], null); Node current = head; for (int i = 1; i < data.length; i++) { Node tmp = new Node(data[i], null); current.setNext(tmp); current = tmp; } C3_5_ReverseLinkedList runner = new C3_5_ReverseLinkedList(); int k = 3; head = runner.reverse(head, k); while (head != null) { System.out.println(head.getValue() + " "); head = head.next(); } }