title: Java converting upper to lower sorting
body: <p>I have a program that sorts lines in  a text file and puts them in alphabetical order but it can't sort the first word because the first word's first letter is uppercase and that word has to have the first letter upper case and I have no idea how to do it.</p>
  
  <p>This is the text file:</p>
  
  <p>Santa, you just better watch your step! </p>
  
  <p>How much is that doggie in the window? </p>
  
  <p>The quick brown fox jumped over the lazy dog. </p>
  
  <p>Have you read Khuth's programming series? </p>
  
  <p>It just doesn't get any better that this!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  public class wordSorter {
  public static void main(String[] args) throws Exception {
  String firstTextFile = "prob10.in.txt";
  String secondTextFile = "prob10.out.txt";
  Scanner Document = null;
  PrintWriter NewFile = null;
  String inputFile = "";
  String outputFile = "";
  
  try{
      Document = new Scanner(new File(firstTextFile));
  }
  catch(Exception e){
      System.out.println("Could not find " + firstTextFile);
      System.exit(0);
  }
  
  try{
      NewFile = new PrintWriter(new FileOutputStream(secondTextFile, true));
  }
  catch(Exception f){
      System.out.println("Could not find " + secondTextFile);
      System.exit(0);
  }
  
  while (Document.hasNextLine()){
  inputFile = Document.nextLine();
  String line = inputFile;
  line = line.toLowerCase();
  String[] words = line.split(" ");
  
  Arrays.sort(words);
  NewFile.println(Arrays.toString(words));
  }
  Document.close();
  NewFile.close();
  
  }
  </code></pre>
  
  <p>}</p>