Here you can find the source of charArrayDigitToInt(char[] str, int start, int len)
Parameter | Description |
---|---|
str | a parameter |
start | a parameter |
end | a parameter |
public static int charArrayDigitToInt(char[] str, int start, int len)
//package com.java2s; public class Main { /**//w w w.ja v a2 s.c o m * * @param str * @param start * @param end * @return */ public static int charArrayDigitToInt(char[] str, int start, int len) { int value = 0; for (int i = start; i < start + len; i++) { value = value * 10; switch (str[i]) { case '0': value += 0x00; break; case '1': value += 0x01; break; case '2': value += 0x02; break; case '3': value += 0x03; break; case '4': value += 0x04; break; case '5': value += 0x05; break; case '6': value += 0x06; break; case '7': value += 0x07; break; case '8': value += 0x08; break; case '9': value += 0x09; break; default: return value; } } return value; } }