new ItemStack(Material.getMaterial(322), 1, (byte) 1); the byte value is your number behind the colon.
That's called metadata. Maybe search for a method like "getMetadata". @MatsExe First, don't spoonfeed, then maybe put your code into Code tags and I don't think that's what Omel wanted to do. I think he wanted to know about getting the metadata value from an existing block, you posted how to create an ItemStack with metadata.. Oh and instead of getting a Material by an id, use Material.GOLDEN_APPLE
@Omel String#split(":") And then grab the second one (i.e. index 1). Make sure the array length is long enough before though. For the future: split takes a RegEx, so be careful with what you put in there or wrap it in a Pattern#quote(String). You can then try to parse it with Integer.parseInt(String). This can throw a NumberFormatException if the number is not valid. Handle it.