(String[] args)
| 34 | } |
| 35 | |
| 36 | public static void main(String[] args) { |
| 37 | int length = 9; |
| 38 | LinkedListNode[] nodes = new LinkedListNode[length]; |
| 39 | for (int i = 0; i < length; i++) { |
| 40 | nodes[i] = new LinkedListNode(i >= length / 2 ? length - i - 1 : i, null, null); |
| 41 | } |
| 42 | |
| 43 | for (int i = 0; i < length; i++) { |
| 44 | if (i < length - 1) { |
| 45 | nodes[i].setNext(nodes[i + 1]); |
| 46 | } |
| 47 | if (i > 0) { |
| 48 | nodes[i].setPrevious(nodes[i - 1]); |
| 49 | } |
| 50 | } |
| 51 | //nodes[length - 2].data = 9; // Uncomment to ruin palindrome |
| 52 | |
| 53 | LinkedListNode head = nodes[0]; |
| 54 | System.out.println(head.printForward()); |
| 55 | System.out.println(isPalindrome(head)); |
| 56 | } |
| 57 | |
| 58 | } |
nothing calls this directly
no test coverage detected