0

I am looking to parse a timestamp in the following format yyyymmddhhmmss to BCD (Packed)

How would I go about implementing it? I understand that we'd use 4 bits for each decimal digit but I am a bit at a loss on how to proceed with the algorithm.

How would I go about the parsing. Do it in pairs of two digits?

For my result to be correct, I should get a returning byte array of length 7. Is my assumption correct?

nmarques
  • 151
  • 12
  • 1
    Seems you're asking how to encode any numeric text into BCD (Packed). Do you know hot the Java bit-manipulation operators work? If so, what is stopping you from using them? If no, now is a good time for you to learn, so do a web search and start reading. – Andreas Mar 04 '19 at 17:43
  • For a String you can do **(new BigInteger(timeStampString, 16)).toByteArray())** - limited validation though , for integers you can use divides, remainder and shifts – Bruce Martin Mar 05 '19 at 01:24

0 Answers0