title: Output prints first and part of second string. String sizes not set correctly
body: <p>I've been writing this program that is supposed to build accounts for people inputted, saving their info all together in as one "superString" string, so it can be written and read from a txt file. I thought I had it all together correctly, but after testing various inputs and then reading back, it seems as though it isn't setting up the string lengths correctly.  </p>
  
  <p>If I only want account number 1, it will print out the account number 1.<br>
  If I put more accounts in and then try to only print out account 1, it'll print out account 1 and part of 2. </p>
  
  <p>The output changes based on the size of the inputs, even though I put loops in there to have strict sizes.  </p>
  
  <p>I've been looking at the same problem for too long now and hopefully I'm just overlooking an easy fix.  Can anyone help me out with this?</p>
  
  <pre><code>public class FirstTr {
  
      private static Scanner input = new Scanner(System.in);
  
      public static void main(String[] args) throws FileNotFoundException, IOException 
      {
  
          File loc = new File("C:\\Users\\Desktop\\Exc2.1.txt");
          RandomAccessFile store = new RandomAccessFile(loc, "rw");
          for(int i=0; i&lt;20; i++)
          {
              String dummy = "12345678901234567890123456789012345678901234567890123456789012345678901";
              store.writeUTF(dummy);
          }
  
  
          String userChoice = GettingUserInput();
          System.out.println("The choice you entered: " +userChoice);
  
  
          while(true){
              if(userChoice.equals("new"))
              {
                  String playerID = PlayerIDMethod();
                  System.out.println("The playerID you entered: " +playerID);
  
                  String playerName = PlayerNameMethod();
                  System.out.println("The playerName you entered: " +playerName);
  
                  String playerTeamName = PlayerTeamNameMethod();
                  System.out.println("The playerTeamName you entered: " +playerTeamName);
  
                  String playerSkillLevel = PlayerSkillLevelMethod();
                  System.out.println("The playerSkillLevel you entered: " +playerSkillLevel);
  
                  String todaysDate = TodaysDateMethod();
                  System.out.println("The date you entered: " +todaysDate);
  
                  String superString = "";
                  superString = playerID + playerName+ playerTeamName + playerSkillLevel + todaysDate;
                  //System.out.println("Combined string is: "+superString);
                  int playerIDDigit = Integer.parseInt(playerID);
                  store.seek((playerIDDigit-1)*73);
                  store.writeUTF(superString);
                  System.out.println("Length of string: " +superString.length());
                  userChoice = GettingUserInput();
  
              }
              if(userChoice.equals("old"))
              {
                  System.out.println("Please enter player ID: ");
                  String desiredID = input.next();
                  int recLocation;
                  recLocation = Integer.parseInt(desiredID);
                  store.seek((recLocation-1)*73);
                  String printed = store.readUTF();
                  System.out.println("String: "+printed);
                  userChoice = GettingUserInput();
              }
              if(userChoice.equals("end"))
              {
                  System.out.println("Program Closed.");
                  store.close();
                  System.exit(0);
              }
  
          }
  
      }
  
  
  
      public static String GettingUserInput()
      {
          System.out.println("Please type in a command: new, old, or end to exit");
          String userChoice = input.next();
  
          while(!userChoice.equals("New") &amp;&amp; !userChoice.equals("new") &amp;&amp; !userChoice.equals("Old") &amp;&amp; !userChoice.equals("old") &amp;&amp; !userChoice.equals("End") &amp;&amp; !userChoice.equals("end"))
          {
              System.out.println("Looks like you didn't enter a correct choice.");
              System.out.println("Please type in a command: new, old or end");
              userChoice = input.next();
          }
  
          return userChoice;
      }
  
  
      public static String PlayerIDMethod()
      {
          String playerID = "";
          Boolean loop = true;
          while(loop)
          {
              try
              {
                  System.out.println("Please input Player ID: ");
                  playerID = input.next();
                  int playerIDDigit = Integer.parseInt(playerID);
  
                  if (playerID.length()&gt; 5){
                      playerID.substring(0,5);
                  }
  
                  if (playerID.length()&lt; 5){
                      StringBuilder paddedName = new StringBuilder(playerID);
                      while(paddedName.length()&lt;5){
                          paddedName.append(" ");
                      }
                      playerID = paddedName.toString();
                  }
  
                  while(Pattern.matches("[a-zA-Z]+", playerID)|| playerID.startsWith("-")|| playerIDDigit&gt;20 || playerIDDigit&lt;0)
                  {
                      System.out.println("Player ID cannot have characters, negatives, and must be within 1-20!");
                      System.out.println("Please input Player ID: ");
                      playerID = input.next();
  
                  }
  
                  loop = false;
  
              }
              catch(Exception e)
              {
                  System.out.println("No way Hosay! Only Integers!");
              }
  
  
          }
          return playerID;
      }
  
  
  
      public static String PlayerNameMethod ()
      {
          String playerName = "";
          try{
              System.out.println("Enter Player's Name: ");
              playerName = input.next();
              while(Pattern.matches("^\\d+", playerName))
              {
                  System.out.println("No cool names include numbers! Try again.");
                  System.out.println("Enter Player's Name: ");
                  playerName = input.next();
              }
              if (playerName.length()&gt; 26){
                  playerName.substring(0,26);
              }
  
              if (playerName.length()&lt; 26){
                  StringBuilder paddedName = new StringBuilder(playerName);
                  while(paddedName.length()&lt;26){
                      paddedName.append(" ");
                  }
                  playerName = paddedName.toString();
              }
  
  
          }
          catch(Exception e){
              System.out.println("ERROR PLEASE TRY AGAIN");
          }
          return playerName;
  
      }
  
  
  
      public static String PlayerTeamNameMethod ()
      {
          String playerTeamName = "";
          try
          {
              System.out.println("Please enter Team name: ");
              playerTeamName = input.next();
              if (playerTeamName.length()&gt; 26){
                  playerTeamName.substring(0,26);
                  System.out.print("The Player Name is" + playerTeamName);
              }
  
              if (playerTeamName.length()&lt; 26){
                  StringBuilder paddedName = new StringBuilder(playerTeamName);
                  while(paddedName.length()&lt;26){
                      paddedName.append(" ");
                  }
                  playerTeamName = paddedName.toString();
              }
          }
          catch(Exception e)
          {
              System.out.println("ERROR PLEASE TRY AGAIN");
          }
          return playerTeamName;
  
      }
  
      public static String PlayerSkillLevelMethod ()
      {
          String playerSkillLevel = "";
          Boolean loop = true;
          while(loop)
          {
              try
              {
                  System.out.println("Please enter player skill level between 0 and 99: ");
                  playerSkillLevel = input.next();
                  while(Pattern.matches("[a-zA-Z]+", playerSkillLevel))
                  {
                      System.out.println("Player skill level must be an integer!");
                      System.out.println("Please enter player skill level between 0 and 99: ");
                      playerSkillLevel = input.next();
                  }
                  loop = false;
              }
              catch(Exception e){
                  System.out.println("ERROR PLEASE TRY AGAIN ");
              }
          }
          return playerSkillLevel;
  
  
      }
  
      public static String TodaysDateMethod (){
          String todaysDate = "";
          try{
              System.out.println("Please enter todays date: ");
              todaysDate = input.next();
              if (todaysDate.length()&gt; 9)
              {
                  todaysDate = todaysDate.substring(1,9);
              }
  
              if (todaysDate.length()&lt; 9)
              {
                  StringBuilder paddedName = new StringBuilder(todaysDate);
                  while(paddedName.length()&lt;26){
                      paddedName = paddedName.append(" ");
                  }
                  todaysDate = paddedName.toString();
              }
          }
  
          catch(Exception e){
              System.out.println("ERROR ");
  
          }
          return todaysDate;
      }
  
      //CONVERT TO STRING
      public static String RecordtoFile (RandomAccessFile store){
          return null;
      }
  
      //WRITE INTO FILE AT RECORD LOCATION INDICATED BY ID
      public static String WriteToFile (RandomAccessFile store){
          return null;
      }
  }
  </code></pre>