If you look at http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html#reverse() you will see that reverse returns a new StringBuffer
so change your code to
sb = sb.reverse();
Also as you are using Intergers not Doubles, then why are you casting the char to a double?
try
int x = Character.getNumericValue(sb.charAt(i));
out += x * Math.pow(3,i);