Convert String Color ("0x5b9f18") to hexcolor in Java
<p>public class Hexcolor {</p>

<pre><code>public static void main(String[] args) {
    String a="0x5b9f18";
    String hexColor = String.format("#%06X", a);
    System.out.println(hexColor);
}
</code></pre>

<p>}</p>

<p>Error Message  </p>

<p>Exception in thread "main" java.util.IllegalFormatConversionException: x != java.lang.String
    at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source)
    at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source)
    at java.util.Formatter$FormatSpecifier.print(Unknown Source)
    at java.util.Formatter.format(Unknown Source)
    at java.util.Formatter.format(Unknown Source)
    at java.lang.String.format(Unknown Source)
    at Hexcolor.main(Hexcolor.java:6)</p>
