I am converting an arbitrary ascii string, which is incidently a number padded with zeros, for example "1" as "0000000001" then to bytes then back in python. Of course the value can be "0000004231" etc. also. It is always numeric and within range of signed 32bit value padded by zeros.
When I tell python that it is bytes and I want it in int, it converts it to a nice large random looking number. Then I can convert it back to original value later using
In : value = int.from_bytes(bytes(format(1, '010d'),'ascii'), byteorder='little') In : value.to_bytes(10,byteorder=sys.byteorder) Out: b'0000000001' In : value Out: 232284873704446901628976 In :
How can I achieve same with java?