title: Converting from Hexadecimal to Binary and vice versa. The Hard Way
body: <p>I'm writing a code that should convert between binary, decimal, and hexadecimal. I have the binary and the decimal figured out but when I got to Hexadecimal I just got confused.</p>
  
  <p>How would you do this conversion without using Integer.toHexString.</p>
  
  <p>I understand that there is already a code that can do this for me in java, my confusion is how to I tell java to do it using hand conversion.</p>
  
  <p>My idea was to create multiple if statements each explaining that 0 is 0000, or C is 1100 and so on for the others.</p>
  
  <p>It would go through each character in the hexadecimal string and add together the binary values.</p>
  
  <p>I feel like this is way to much code for what I'm being asked to do.</p>
  
  <p>Unless this is the only way to do it, then I'll start doing it like that.</p>
  
  <p>but if there is a pseudo-code that explains how to do this more effectively that would be appreciated.</p>
  
  <p>extra info:</p>
  
  <pre><code>int hexDigit1A=(binaryDigit8%2)*8+(binaryDigit7%2)*4+(binaryDigit6%2)*2+(binaryDigit5%2)*1;
  int hexDigit2A=(binaryDigit4%2)*8+(binaryDigit3%2)*4+(binaryDigit2%2)*2+(binaryDigit1%2)*1; 
  </code></pre>
  
  <p>I understand that this converts a 4 bit binary number to its appropriate decimal, would this even be useful or is it just good for decimal.</p>
  
  <p>Much thank you in advance.</p>