I can only get correct output for decimal less than five. the output for five is 110 when it should be 101. the output for six is 101 and the output for ten is 1100.
//while loop divides each digit
while (decimal > 0)
{
//divides and digit becomes the remainder
int digit = decimal % 2;
//makes the digit into a string builder so it can be reversed
binaryresult.append(digit);
decimal = decimal / 2;
display.setText(binaryresult.reverse());
}