I am trying to understand the implementation of Integer.toString(), which looks like this:
public static String toString(int i) {
if (i == Integer.MIN_VALUE)
return "-2147483648";
int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
char[] buf = new char[size];
getChars(i, size, buf);
return new String(0, size, buf);
}
And I ran into the last line, which doesn't look like any of the constructors in the String class, except this one:
String(char value[], int offset, int count)
...except that this function is called with the char[] argument first, unlike how it is being used in Integer.toString(). I was under the impression that changing the order of arguments counted as a change in the signature of the method, and would be a different overwrite of the method.
Why does this work, or am I interpreting this incorrectly?