title: Sort string by Shell Sort
body: <p>I have a text file of 50 string lines of varying length and content. I need to read the file and sort in ascending order. 
  Sorting condition: the number of words in a sentence that start from the letter "a" </p>
  
  <pre><code>  public static void main(String[] args) throws FileNotFoundException {
      String token1 = "";
      Scanner inFile1 = new Scanner(new File("E:\\text.txt"));
  
      List&lt;String&gt; temps = new LinkedList&lt;String&gt;();
      inFile1.useDelimiter(". ");
  
      while (inFile1.hasNext()) {
          token1 = inFile1.nextLine();
          temps.add(token1);
      }
      inFile1.close();
  
      String[] tempsArray = temps.toArray(new String[0]);
      for (int i = 0; i &lt; tempsArray.length; i++) {
          System.out.println(tempsArray[i]);
      }
  
      int cnt = 0; //counts of words in the string line
      for (int i=0; i&lt;tempsArray.length; i++) {
          int k=0; //counts of words that start from the letter "а"
          System.out.println("Line № = " + i);
          StringTokenizer st = new StringTokenizer(tempsArray[i]);           
          while (st.hasMoreTokens()) {
              cnt++;
              String s= st.nextToken();
              if (s.charAt(0)=='a') {                    
                  k++;               
              }             
          }
         System.out.println("Words count = " + cnt);
         cnt=0;
         System.out.println("Words 'а' = " + k);  
      }       
  }
  </code></pre>
  
  <p>New question: how do i move to sorting string lines by <strong>k</strong> ? What else should I do after that code?</p>