while ( i < binaryreversed.length());

That will be executing the ; every time.