Java tutorial
//package com.java2s; public class Main { @SuppressWarnings("unused") private static int compareToBigInteger(String s1, String s2) { int ret = 0; char[] c1 = s1.toCharArray(); char[] c2 = s2.toCharArray(); int index1 = 0, index2 = 0; while (index1 < c1.length && c1[index1] == '0') index1++; while (index2 < c2.length && c2[index2] == '0') index2++; if (c1.length - index1 != c2.length - index2) { ret = (c1.length - index1) - (c2.length - index2); } else { ret = c1[index1] - c2[index2]; } return ret; } }