The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse()
. There is some discussion of this here here.
If you do need to roll your own reversing method, you can avoid using StringBuffer
/StringBuilder
at all and simply do new String(array)
instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder
in preference to StringBuffer
you should probably use StringBuilder
in preference to StringBuffer
.
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse()
. There is some discussion of this here.
If you do need to roll your own reversing method, you can avoid using StringBuffer
/StringBuilder
at all and simply do new String(array)
instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder
in preference to StringBuffer
.
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse()
. There is some discussion of this here.
If you do need to roll your own reversing method, you can avoid using StringBuffer
/StringBuilder
at all and simply do new String(array)
instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder
in preference to StringBuffer
.
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse()StringBuffer.reverse()
. There is some discussion of this here: http://stackoverflow.com/questions/2439141/what-is-the-most-efficient-algorithm-for-reversing-a-string-in-javahere .
If you do need to roll your own reversing method, you can avoid using StringBufferStringBuffer
/StringBuilderStringBuilder
at all and simply do new String(array)new String(array)
instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder in preference to StringBuffer (see http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-javayou should probably use StringBuilder
in preference to StringBuffer
).
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse(). There is some discussion of this here: http://stackoverflow.com/questions/2439141/what-is-the-most-efficient-algorithm-for-reversing-a-string-in-java
If you do need to roll your own reversing method, you can avoid using StringBuffer/StringBuilder at all and simply do new String(array) instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder in preference to StringBuffer (see http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java )
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse()
. There is some discussion of this here .
If you do need to roll your own reversing method, you can avoid using StringBuffer
/StringBuilder
at all and simply do new String(array)
instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder
in preference to StringBuffer
.
The code appears to be functionally correct, although you could simply choose to use a StringBuffer.reverse(). There is some discussion of this here: http://stackoverflow.com/questions/2439141/what-is-the-most-efficient-algorithm-for-reversing-a-string-in-java
If you do need to roll your own reversing method, you can avoid using StringBuffer/StringBuilder at all and simply do new String(array) instead.
As a general point, if you're not dealing with multithreaded code you should probably use StringBuilder in preference to StringBuffer (see http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java)