Created
January 17, 2012 04:38
-
-
Save soc/1624747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Example: new int[]{Integer.MAX_VALUE, 1} should be treated as one large, unsigned number and print: 8589934590 (So basically 2³³). | |
| def toSimpleString(num: Array[Int]) = { | |
| val iArr = num.clone | |
| val s = new Array[Char](iArr.length * 10) | |
| var i = s.length - 1 | |
| var div = 0L | |
| while (i >= 0) { | |
| s(i) = ('0' + (iArr(i) % 10).toChar).toChar | |
| div = (iArr(i) / 10) | |
| i = i - 1 | |
| } | |
| new String(s, i, s.length) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment