BigInteger的Java Base转换

问题描述

在此程序中,我需要能够获取一个String并通过使用BigInteger将其转换为(2-36)的基数

我是java的新手,我正在尝试通过使用BigInteger而不是下面的方法来找到一种使用基本转换的方法。尽管这可以按预期工作,但我仍希望获得一些有关如何简化它的提示。对于此项目,我无法使用Integer或BigInteger中的内置基本转换函数

这是我下面的转换。

  public static String convertInteger(String theValue,int initialBase,int finalBase) {
       
      BigInteger bigInteger = new BigInteger(theValue,initialBase);
           String value = bigInteger.toString(finalBase);
           value = value.toupperCase();
           
       
       
       
       return value;
   }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)