Skip to content

Instantly share code, notes, and snippets.

@soc
Created January 17, 2012 04:38
Show Gist options
  • Select an option

  • Save soc/1624747 to your computer and use it in GitHub Desktop.

Select an option

Save soc/1624747 to your computer and use it in GitHub Desktop.
// 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