Scratching my head, it sounds pretty simple though. A DECIMAL type is probably implemented (for you) as a BigDecimal. You can toString() that type. Once you've got a string, you're most of the way to BCD. Take each character, subtract "0" and stuff the result in a byte of a byte array. For signed numbers, that's a trickier proposition and depends on the packed format; I don't recall any signed BCD formats offhand.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.