So, In Java, you know how you can declare integers like this:
int hex = 0x00ff00;
I thought that you should be able to reverse that process. I have this code:
Integer.valueOf(primary.getFullHex());
where primary is an object of a custom Color class. It's constructor takes an Integer for opacity (0-99) and a hex String (e.g. 00ff00
).
This is the getFullHex
method:
public String getFullHex() {
return ("0x" + hex);
}
When I call this method it gives my this NumberFormatException
:
java.lang.NumberFormatException: For input string: "0xff0000"
I can't understand what's going on. Can someone please explain?
Integer.parseInt(..)
could take another parameter! Thanks for clearing that up for me! – Pettifogger