This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello everyone. This is the second time I've came here with a specific question. Everyone was great last time - I learned so much in the process. This time, my question is quite simple.
Basically, I am inputting an integer. The integer needs to be transformed into a "hexcode." In this example, 525 is input. It needs to be turned into 0D (525 % 16 % 16). However, it is output as DD. No matter what number I put in, the first and second digits are the same.
This is the process I am going for: An integer % 16 -> Result (we'll call it code1) is sent to toHexDigit, where appropriate digit is returned (hex1). Now, code1 % 16. This result (code2) is sent to toHexDigit, where appropriate digit is returned (hex2). After that, I want to assign both of the returned digits (hex1 % hex2) to a variable, called code.
I've written the whole process out on paper and debugged it several times. I'm missing something, apparently. It seems that the integrity of one of the values is lost at some point. If anyone has any tips, please let me know. I've been staring at this for a long time with no improvement.