Here you can find the source of reverse(BigInteger n)
public static BigInteger reverse(BigInteger n)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { public static long reverse(long n) { String s = String.valueOf(n); StringBuilder sb = new StringBuilder(s); return Long.valueOf(sb.reverse().toString()); }//w ww .ja v a 2 s . c om public static BigInteger reverse(BigInteger n) { String s = n.toString(); StringBuilder sb = new StringBuilder(s); return new BigInteger(sb.reverse().toString()); } }