I have a base64 string like this = "pCZXOVjpnlePyDk6znZrSw==" i need a encoder/decoder to convert it to decimal string like this = "84587163248712923874"
Is there any codec that do it?
You probably need a two stage process:
16 bytes is too big for a Java long so I assume that you will need a BigInteger
. There is a BigInteger
constructor that takes a byte array as parameter, though you will need to be careful with the sign bit. The toString()
method for the BigInteger
will give you the string you want.
Base64 encode/decode is part of the default libraries now (finally). Look at the class javax.xml.bind.DatatypeConverter . In there you will find two methods printBase64Binary and parseBase64Binary (along with a few other conversion routines).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.