title: chek if the elements of the list is between two ip addresses in java
body: <p>I want to write a function that receives two variables of type String representing two IP addresses and a third variable representing a group of IP addresses. The function returns all addresses between IP1 and IP2 from the given set of addresses, taking into account the order.</p>
  <p>this is the function signature:</p>
  <pre><code>public static String[] get_available_IPs(String ip1, String ip2, String[] addresses)
  </code></pre>
  <p>I tried to split each ip to compare them in the end but I didn't get any result</p>
  <p>This is the code that I wrote while i'm trying to solve this problem.
  I don't think that it will help you to solve the problem but I just want you to take a look of what I did.</p>
  <pre><code>String[] ip_numbers1 = ip1.split(&quot;\\.&quot;);
      String[] ip_numbers2 = ip2.split(&quot;\\.&quot;);
      String[][] ip_numbers3 = new String[4][addresses.length];
      
      boolean[] flags = new boolean[4];
      
      for (int i = 0; i &lt; addresses.length; i++) {
          for (int j = 0; j &lt; 4; j++) {
              String[] new1 = addresses[j].split(&quot;\\.&quot;);
              for (int k = 0; k &lt; 4; k++) {
                  ip_numbers3[j][k] = new1[k];
              }
          }
      }
      
      for (int i = 0; i &lt; ip_numbers3.length; i++) {
          if (Integer.parseInt(ip_numbers1[0]) &lt;= Integer.parseInt(ip_numbers3[i][0])
                  &amp;&amp; Integer.parseInt(ip_numbers2[0]) &gt;= Integer.parseInt(ip_numbers3[i][0])) {
              flags[i] = true;
          }
      }
  </code></pre>
  <p>sample inputs and outputs:</p>
  <pre><code>input:
  ip1 = '192.168.1.1'
  ip2 = '220.150.1.0'
  addresses = ['193.168.10.20','221.155.1.5','194.200.1.5','192.168.1.2']
  
  output:
  ['194.200.1.5','193.168.10.20','192.168.1.2']
  
  input:
  ip1 = '191.168.1.1'
  ip2 = '222.155.1.5'
  addresses = ['193.168.10.20','221.155.1.5','194.200.1.5','192.168.1.1']
  
  output:
  ['221.155.1.5','194.200.1.5','193.168.10.20','192.168.1.1']
  </code></pre>