title: Proper way to sort a File array in ascending order by last number
body: <p>I have various files in the internal memory, each one's finish his name with a number and his format, example:</p>
  
  <pre><code>/storage/emulated/0/packets
  </code></pre>
  
  <ul>
  <li>File 1.x</li>
  <li>File 2.x</li>
  <li>...</li>
  <li>File 11.x</li>
  </ul>
  
  <p>I made a code to retrieve the files and sort in ascending order, but when the files are more than 10, the sort fail.</p>
  
  <p>My code:</p>
  
  <pre><code>ArrayList&lt;String&gt; list;
  
  public static boolean SetFileList(String directory){
      list = new ArrayList&lt;&gt;();
  
      if(DirectoryExist(directory)) { //DirectoryExist() verify if the parameter directory it's a true directory
          File[] files = new File(directory).listFiles();
  
          if (files == null) {
              return false;
          }
  
          else if (files.length == 0) {
              return false;
          }
  
          else {
              Arrays.sort(files); //&lt;------this method is supposed to sort
  
              for (File file : files) {
                  list.add(file.getName());
              }
  
              return true;
          }
      }
  
      else{
          return false;
      }
  }
  </code></pre>
  
  <p>When I use the following code to show the files:</p>
  
  <pre><code>for(int i = 0; i &lt; list.size(); i++){
      Log.i("File", list.get(i));
  }
  </code></pre>
  
  <p>Throws something like:</p>
  
  <pre><code>File: File 1.x
  File: File 10.x
  File: File 11.x
  File: File 12.x
  File: File 2.x
  File: File 3.x
  File: ...
  </code></pre>
  
  <p>But I want to show:</p>
  
  <pre><code>File: File 1.x
  File: File 2.x
  File: File 3.x
  File: ...
  File: File 10.x
  File: File 11.x
  File: File 12.x
  </code></pre>
  
  <p>Why is this happening?</p>