title: If statement with appending file
body: <p>Need to write a program that removes the last character of a file only if it's not an int / number. This what I have so far.</p>
  
  <pre><code>import java.io.*;
  
   public class RemoveTurn{
       public static void main(String[] arg){
           try{
           RandomAccessFile raf = new RandomAccessFile("test.txt", "rw");
           long length = raf.length();
           System.out.println("File Length="+raf.length());
           //supposing that last line is of 8 
           raf.setLength(length - 1);
           System.out.println("File Length="+raf.length());
           raf.close();
           }catch(Exception ex){
           ex.printStackTrace();
       }
     }
  }
  </code></pre>
  
  <p>Program skeleton was taken from: <a href="http://java.happycodings.com/core-java/code66.html" rel="nofollow">happycodings.com</a></p>