The width used in format is always a minimum width. In this case, instead of using sub string operations I would suggest:
String.format("%05X", decInt & 0xFFFFF);
The width used in format is always a minimum width. In this case, instead of using sub string operations I would suggest:
String.format("%05X", decInt & 0xFFFFF);