title: Printing nodes whose value is smaller than than the value set in the parameter
body: <p>I have this code which is supposed to take in a linked list and return the nodes which are lesser than the value of node specified in the parameter, but it is doing exact opposite. What I am doing wrong?</p>
  
  <pre><code>static LinkedListNode removeNodes(LinkedListNode list, int x) {
      LinkedListNode current = list;
      while(current.next != null ){
          if (current.val &gt;x){
              if (current.next.next == null){
                  break;
              }
              else{
              current = current.next.next;
              }
          }
          else{
              current = current.next;
          }
      }
      return current;
  }
  </code></pre>