将任意进制的数转换为另一个任意进制的数

main
晨雾繁星 2 months ago
parent 8d03af1e84
commit 49fe5bf95b

@ -43,5 +43,16 @@ public class BaseConverter {
return result.toString();
}
/**
*
*
* @param str
* @param sourceBase
* @param targetBase
* @return
*/
public static String convertBase(String str, int sourceBase, int targetBase) {
int decimalValue = toDecimal(str, sourceBase);
return fromDecimal(decimalValue, targetBase);
}
}
Loading…
Cancel
Save