Alan Hollis wrote:On another note; if anyone has time.
Is there a quick way of doing
int Hours = Integer.parseInt(HexTime.substring(0, 2),16); // 1
int Minutes = Integer.parseInt(HexTime.substring(2, 4),16); // 1
int Seconds = Integer.parseInt(HexTime.substring(4,6),16); // 1
String Time = String.format("%02d",Hours)+":"+
return Time; // 01:01:01
I don't like converting to an integer and then back to a string just to get it formatted correctly. As above example
This is also quite slow. (Speed really is of the essence with this application)
I've had a quick google and I can't find a better way. Any bright sparks here think of anything?
Alan Hollis wrote:Just looking for clarification really that I'm doing the correct (fastest) thing.
Profiling shows this GetBytes() is taking the most amount of time in my code (obviously the functions called the most amount of times too).
However I was wondering if there's a quicker way of achieving what I'm doing above.
Apologises what might seem a silly question, but I'm new to java, and the only developer in my new job. Which means I only have you guys to discuss things with ;) (Feel free to critique the code too!!!) The code all works, I'm just unhappy with how long it takes ...
p.s CDRByteArray is always 133 bytes in size, not sure if this helps?