title: How to reverse words of a Java String
body: <p>Im trying to make a program to take input for a string from the scanner, but i want to break up the string that was inputed and reverse the order of words. This is what i have so far. </p>
  
  <pre><code>Scanner input = new Scanner(System.in);
  System.out.println("Enter your string");
  StringBuilder welcome = new StringBuilder(input.next());
  int i;
  for( i = 0; i &lt; welcome.length(); i++ ){
      // Will recognize a space in words
      if(Character.isWhitespace(welcome.charAt(i))) {
          Character a = welcome.charAt(i);
      }   
  }
  </code></pre>
  
  <p>What I want to do is after it recognizes the space, capture everything before it and so on for every space, then rearrange the string. </p>