public static ListNode rotateRight(ListNode head, int n) {
		if (head == null)
			return null;
		if (n == 0)
			return head;
		int length = 1;
		ListNode countLength = head;
		while (countLength.next != null) {
			length++;
			countLength = countLength.next;
		}
		if (n % length == 0)
			return head;
		int newHeadPos = length - (n % length);
		ListNode newTail = head;
		ListNode newHead = head;
		ListNode tail = head;
		int i = 0;
		while (i < newHeadPos && newHead.next != null) {
			newHead = newHead.next;
			i++;
		}
		i = 0;
		while (i < newHeadPos - 1 && newTail.next != null) {
			newTail = newTail.next;
			i++;
		}

		while (tail.next != null) {
			tail = tail.next;
		}

		tail.next = head;
		newTail.next = null;
		return newHead;
	}