private static int _outputUptoBillion(int v, byte[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; enc = TRIPLET_TO_CHARS[ones]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; return off; }
private static int _outputUptoBillion(int v, char[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); enc = TRIPLET_TO_CHARS[ones]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); return off; }
private static int _outputUptoBillion(int v, char[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); enc = TRIPLET_TO_CHARS[ones]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); return off; }
private static int _outputUptoBillion(int v, byte[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; enc = TRIPLET_TO_CHARS[ones]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; return off; }
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
private static int _outputUptoBillion(int v, byte[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; enc = TRIPLET_TO_CHARS[ones]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; return off; }
private static int _outputUptoBillion(int v, char[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); enc = TRIPLET_TO_CHARS[ones]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); return off; }
private static int _outputUptoBillion(int v, char[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); enc = TRIPLET_TO_CHARS[ones]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); return off; }
private static int _outputUptoBillion(int v, byte[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; enc = TRIPLET_TO_CHARS[ones]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; return off; }
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);
off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off);