I create buffered writer
BufferedWriter errorReport = new BufferedWriter(new FileWriter("ErrorReport.txt"));
Then I wanted to write while converting my integer to a hex.
errorReport.write(Integer.toHexString(version))
This works perfectly, except it omits leading 0's as it writes the minimum possible length. Say 'version' is a byte in length and simply prints 6. Well I know the actual value is actually 06. How do I keep these leading 0's?
I tried errorReport.write(String.format("%03x", Integer.toHexString(version)), but get an error for illegalFormatConversionException x != java.lang.String