   [java] StringBuffer difficulties
  I used the stringbuffer class and wrote the following code to create a reversed stringIts supposed to take a string Parameter and return a new string in reversebut for some reason nothing pops up. I got no syntax errors, and as far as I can tell the code is good. I prototyped code in Main before writing this function and it seemed to work fine------------------------------------------------------public String sReverse(String $input){    // write an expression whose value is the reverse of the String s// (you will need local variables and multiple statements for this)    // EXERCISE 5: INSERT YOUR CODE HERE:  StringBuffer $neoString = new StringBuffer(""); int stringIndex = $input.length()-1;  $neoString.setLength(stringIndex);  int indexer;  for(indexer = stringIndex ; indexer < 0 ; indexer--)  { char Letter = $input.charAt(indexer); $neoString.append(Letter);   }  String reverseFinal = new String($neoString.toString());  //reverseFinal = $neoString.toString();  return reverseFinal;  }---------------------------------------------------------------------The problem is when I try to call the function nothing happens.what am I doing wrong?I''m hopping someone with more veteran experience can help me out here. do any of you think I should try using a diffrent kind of loop? 
  a couple of things...1) in your for loop you you were doing it 'till indexer was greater than 0 which it always would be so it skipped the loop entirely2) you set your StringBuffer to the index length and then were appending to it so this left spaces at the begining on the StringBuffer.Try this.. it should work public String sReverse(String $input){// write an expression whose value is the reverse of the String s // (you will need local variables and multiple statements for this)// EXERCISE 5: INSERT YOUR CODE HERE:StringBuffer $neoString = new StringBuffer("");int stringIndex = $input.length()-1;//$neoString.setLength(stringIndex);//int indexer;for(int indexer = stringIndex ; indexer >= 0 ; indexer--){char Letter = $input.charAt(indexer);$neoString.append(Letter);}String reverseFinal = new String($neoString.toString());//reverseFinal = $neoString.toString();return reverseFinal; }    [edited by - CthulhuLives on February 4, 2004 7:02:15 PM];  thanks ;  Maybe you aren''t allowed to but why not just use the reverse() method in the StringBuffer class? ;quote:Original post by Mr_Ridd  Maybe you aren''t allowed to but why not just use the reverse() method in the StringBuffer class?   hehe, shhh. ;  And what''s with the dollar signs in the variable names?  Technically they''re legal, but how annoying...  This isn''t perl.  Get rid of them. ;  Always reinventing the wheel, are we?Isn''t using standard, ready to use and tested functionality the best way to go? 