Here you can find the source of charArrayToInt(char[] data, int start, int length, int[] end)
public static int charArrayToInt(char[] data, int start, int length, int[] end) throws NumberFormatException
//package com.java2s; //License from project: Open Source License public class Main { public static int charArrayToInt(char[] data, int start, int length, int[] end) throws NumberFormatException { boolean neg = false; if (data[start] == '-') { neg = true;// w w w .ja v a2 s . co m start++; } else if (data[start] == '+') { start++; } int result = 0; int i; for (i = start; i < length; i++) { int digit = data[i] - '0'; if (digit < 0 || digit > 9) { return result; } result = result * 10 + digit; } end[0] = i; return neg ? -result : result; } }