在Java中将BigInteger转换为Shorter String [英] Convert BigInteger to Shorter String in Java
本文介绍了在Java中将BigInteger转换为Shorter String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种将BigInteger转换为非常短的String(最短的)的方法。转换需要是可逆的。在这种情况下,转换的安全性并不是什么大问题。有没有人会有他们如何解决这个问题的建议或样本?
I'm looking for a way to convert a BigInteger into a very short String (shortest possible). The conversion needs to be reversible. The security of the conversion is not a big deal in this case. Would anyone have recommendations or samples of how they would go about solving this problem?
推荐答案
一种简单的方法是使用 BigInteger.toString(Character.MAX_RADIX)
。要反转,请使用以下构造函数: BigInteger(String val,int radix)
。
One easy way is to use BigInteger.toString(Character.MAX_RADIX)
. To reverse, use the following constructor: BigInteger(String val, int radix)
.
这篇关于在Java中将BigInteger转换为Shorter String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文