title: Find smaller or equal to X from duplicated sorted list
body: <p>Given an array list and sorted</p>
  
  <pre><code>ArrayList&lt;Integer&gt; list1 = new ArrayList&lt;&gt;();
  list1.add(1);
  list1.add(4);
  list1.add(15);
  list1.add(16);
  list1.add(3);
  list1.add(3);
  list1.add(8);
  System.out.println(list1); // [1, 4, 15, 16, 3, 3, 8]
  Collections.sort(list1,3);
  System.out.println(list1); // [1, 3, 3, 4, 8, 15, 16]
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/19579652/find-greater-than-x-from-list-when-x-doesnt-exist-in-list">To find larger</a> or equal in the sorted duplicated list, say '3'</p>
  
  <pre><code>int index = Collections.binarySearch(list1, 3);
  ArrayList&lt;Integer&gt; list2 = new ArrayList&lt;&gt; (list1.subList(index &lt; 0 ? - index - 1 : index, list1.size()));    
  </code></pre>
  
  <p>which give us</p>
  
  <pre><code>[3,3,4,8,15,16]
  </code></pre>
  
  <p>But how to do that for smaller or equal case? Here is what I tried.</p>
  
  <pre><code>ArrayList&lt;Integer&gt; list3 = new ArrayList&lt;&gt; (list1.subList(0, index &lt; 0 ? - index - 1 : index + 1));
  </code></pre>
  
  <p>which output</p>
  
  <pre><code>[1, 3]
  </code></pre>
  
  <p>expected output</p>
  
  <pre><code>[1, 3, 3]
  </code></pre>