convert String into int without using parse

 public class test1 {

    public static void main(String[] args) {
String abc = "123";
int t=0;

char arr1[] = abc.toCharArray();

for(int i=0;i<arr1.length;i++){
t = t*10 + (arr1[i]-'0');
}
System.out.println(t);
}

}

Comments

Popular posts from this blog

Rest Assured

Sort (Bubble) - Java

Rotate the String from position - Java