title: convert text to ascii code
body: <p>Hello I was wonder how I would using a text file I have being read through java turn the character into ascii code (eg. h = 104). I already have the code so that the program reads the text file. The file reads: 
  this is line one, this is line two, this is line three. each line is on its own line. now I need some help trying to separate each character and then convert them into ascii code.</p>
  
  <pre><code>        package readwritetextfile;
          import java.io.*;
  
          public class ReadWriteTextFile {
  
              /**
               * @param args the command line arguments
               */
  
                  // TODO code application logic here
                  /** JDK 6 or before. */
  
            /**
            * Fetch the entire contents of a text file, and return it in a String.
            * This style of implementation does not throw Exceptions to the caller.
            *
            * @param aFile is a file which already exists and can be read.
            */
  
              /**
               * Fetch the entire contents of a text file, and return it in a String.This style of implementation does not throw Exceptions to the caller.
               * @param aArguments
               * @param aFile is a file which already exists and can be read.
               * @return
               * @throws java.io.IOException
               */
            public static void main (String... aArguments) throws IOException {
              File testFile;
                testFile = new File("C:\\...\\readlines.txt");
              System.out.println("Original file contents: " + getContents(testFile));
              setContents(testFile, "The content of this file has been overwritten...");
              System.out.println("New file contents: " + getContents(testFile));
  
              /**
               *
               * @param aFile
               * @return
               */}
              static public String getContents(File aFile) {
              //...checks on aFile are elided
              StringBuilder contents = new StringBuilder();
  
              try {
                //use buffering, reading one line at a time
                //FileReader always assumes default encoding is OK!
                BufferedReader input =  new BufferedReader(new FileReader(aFile));
                try {
                  String line = null; //not declared within while loop
                  /*
                  * readLine is a bit quirky :
                  * it returns the content of a line MINUS the newline.
                  * it returns null only for the END of the stream.
                  * it returns an empty String if two newlines appear in a row.
                  */
                  while (( line = input.readLine()) != null){
                    contents.append(line);
                    contents.append(System.getProperty("line.separator"));
                  }
                }
                finally {
                  input.close();
                }
              }
              catch (IOException ex){
              }
  
              return contents.toString();
            }
          static public void setContents(File aFile, String aContents)
                                           throws FileNotFoundException, IOException {
              if (aFile == null) {
                throw new IllegalArgumentException("File should not be null.");
              }
              if (!aFile.exists()) {
                throw new FileNotFoundException ("File does not exist: " + aFile);
              }
              if (!aFile.isFile()) {
                throw new IllegalArgumentException("Should not be a directory: " + aFile);
              }
              if (!aFile.canWrite()) {
                throw new IllegalArgumentException("File cannot be written: " + aFile);
              }
  
              //use buffering
              Writer output = new BufferedWriter(new FileWriter(aFile));
              try {
                //FileWriter always assumes default encoding is OK!
                output.write( aContents );
              }
              finally {
                output.close();
              }
            }
  
            /** Simple test harness.
               * @param aArguments
               * @throws java.io.IOException */
  
  
          } 
  </code></pre>
  
  <p>`</p>