0

I have the following statement: binaryOutput = y % 2 + binaryOutput;

I want to the value of y % 2 to be added at the very beginning of binaryOutput. Is there a better way to do this operation than the way I did it? I feel like my method is a little redundant.

Edit: binaryOutput is a String object. y is an integer.

1 Answers1

0

USe the insert method of StringBuilder:

_sb.insert(0, "Hello ");
CoupFlu
  • 311
  • 4
  • 20