kenziedil2514 kenziedil2514 20-03-2024 Computers and Technology contestada For the given below Linked List class. Complete the method that puts the linked list in reverse.javaclass Node { int data; Node next; public Node(int data) { this.data = data; this.next = null; } } class LinkedList { Node head; public LinkedList() { this.head = null; } public void insert(int data) { Node newNode = new Node(data); if (head == null) { head = newNode; } else { Node current = head; while (current.next != null) { current = current.next; } current.next = newNode; } } public void print() { Node current = head; while (current != null) { System.out.print(current.data + " "); current = current.next; } System.out.println(); } public void reverse() { Node prev = null; Node current = head; Node next = null; while (current != null) { next = current.next; current.next = prev; prev = current; current = next; } head = prev; } } public class ReverseLinkedListExample { public static void main(String[] args) { LinkedList linkedList = new LinkedList(); linkedList.insert(1); linkedList.insert(2); linkedList.insert(3); linkedList.insert(4); linkedList.insert(5); linkedList.reverse(); linkedList.print(); } }