List of utility methods to do BigInteger Reverse
BigInteger | reverse(BigInteger currentSum) reverse String num = currentSum.toString(); String rev = new StringBuilder(num).reverse().toString(); BigInteger revNum = new BigInteger(rev); return revNum; |
BigInteger | reverse(BigInteger n) reverse String s = n.toString(); StringBuilder sb = new StringBuilder(s); return new BigInteger(sb.reverse().toString()); |
BigInteger | reverse(BigInteger x, int width) reverse try { if (width < Long.SIZE) return BigInteger.valueOf(reverse(x.longValueExact(), width)); } catch (ArithmeticException ex) { StringBuilder str = new StringBuilder(x.toString(2)); if (str.length() > width) str.delete(0, str.length() - width); ... |