This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have a buffer obtained by executing MQMessage.readLine(); This buffer is expected to contain a String, but apparently its first two character positions contain an int. How can I obtain this int? Integer.parseInt will not work and neither with Byte.decode(), and int x = (int) stringAB is illegal. Everyone thinks I'm weird to ask this question. What am I missing?
What exactly is in the first two character positions? If it's a string like "01" you can substring and then use Integer.parseInt(). If it's something binary like 0x00 0x01 then I'm worried about it making the transition from the message to a String and back to a number. You can try taking a substring and getBytes() and working from there.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Nov 02, 2000
Thanks a lot for the fast response! That was a big help.