Java Parse Int parseInt(char[] strs, int beginindex, int endindex)

Here you can find the source of parseInt(char[] strs, int beginindex, int endindex)

Description

parse Int

License

Apache License

Declaration

private static int parseInt(char[] strs, int beginindex, int endindex) throws ParseException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;

public class Main {

    private static int parseInt(char[] strs, int beginindex, int endindex) throws ParseException {
        int result = 0;
        int b = 1;
        for (int i = endindex - 1; i >= beginindex; i--) {
            if (strs[i] < 48 || strs[i] > 57) {
                throw new ParseException("Parse error,can't parse char to int . ", 0);
            }/*w  ww.jav a2s .  c  om*/
            result = result + (strs[i] - 48) * b;
            b *= 10;
        }
        return result;
    }
}

Related

  1. parseInt(char[] input, ParsePosition offset, int length)
  2. parseInt(String src, Locale loc)
  3. parseInt(String stringValue)
  4. parseInt(String value)
  5. parseInteger(PushbackReader reader)