title: Java Upside down and read words like
body: <p>Question:
  For all of the following words, if you move the first letter to the end of the word, and then spell the result backwards, you will get the original word:<br>
  Ex. banana dresser grammar potato revive uneven assess<br>
  Write a program that reads a word and determines whether it has this property. <br>Continue reading and testing words until you encounter the word quit. <br>Treat uppercase letters as lowercase letters.</p>
  
  <pre><code>   package homework;
  
      import java.util.Scanner;
  
      public class Ex09 {
          public static void main(String args[]){
              Scanner keyboard = new Scanner(System.in);
  
              String arrInput[],input;
              String arrText[] = null,text,text_word,text_remain;
              int i;
              boolean check = true;
  
              while(true){
                  //Type
                  System.out.println("type string: ");
                  input = keyboard.nextLine();
                  input = input.toLowerCase();
  
                  //If user type quit, terminate the program
                  if(input.compareTo("quit")==0) break;
  
                  arrInput = input.split(""); //by breaking the input should be kept in arrInput (the input array)
  
                  //Send letters to the front to the back of the input (stored separately in the text)
                  text_word = input.substring(0, 1); //the beginning of the input text to Back
                  text_remain = input.substring(1, input.length()-1); //from the second to the last character of the input
                  text = text_remain.concat(text_word); //merges into the text
  
                  //break up the text should be kept in arrText (the text array)
                  arrText = text.split("");
  
                  //input (from the back) and text (from the front) to check for equality
                  //Correct, check = true, incorrect, check = false
                  for(i=0; i&lt;input.length(); i++){
                      if(arrInput[i].equals(arrText[(input.length()-1)-i])){
                          check = true;
                      }
                      else {
                          check = false;
                          break;
                      }
                  }
  
                  //correct
                  if(check){
                      System.out.println("equal");
                  }
                  //incorrect
                  else{
                      System.out.println("Not equal");
                  }
              }   
          }
      }
  </code></pre>
  
  <p>I can't see this code's problem.
  But when I execute this code,</p>
  
  <pre><code>type string: 
  banana
  Not equal
  type string: 
  uneven
  Not equal
  type string: 
  </code></pre>
  
  <p>What's the matter of this code?</p>