title: Convert value to binary and then flip all the bits in Java
body: <p>First of all i receive a hex color code from a parameter 'col'. I then convert this value to the binary equivalent and then need to flip all the bits and convert it back to the hex value. Then the hex value needs to be padded out to 6 characters.</p>
  
  <pre><code>public String invertColor(String col)
  {
      String inverted = col;
  
      int i = Integer.parseInt(inverted, 16);
      String bin = Integer.toBinaryString(i);
      System.out.println(bin);
  
      int binary = Integer.parseInt(bin,2);
      System.out.println(binary);
  
  
      return inverted;
  }
  </code></pre>
  
  <p>This is the code i have so far, i have been racking my brains all morning and just cannot seem to get a working solution. Any help at all would be appreciated. </p>
  
  <p>Thanks</p>