From your question what i have deduced that, you want to add up all numbers in the word.Here is how you can achieve that:
You can just get the string input and then , use a for loop to find sum of all of its characters and then finally print it , here is the simple logic for the same:
String str="1234567";
int sum=0;
for(int i=1;i<str.length();i=i+2){
sum+=(str.charAt(i)-'0');
}
System.out.println(sum);
You can take input from user for the number and can do the same
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter number : ");
String number=null;
try{
number = reader.readLine();
}
catch (IOException e) {
e.printStackTrace();
throw e;
}
int sum=0;
for(int i=1;i<number.length();i=i+2){
sum+=(number.charAt(i)-'0');
}
System.out.println(sum);
In both cases you will get the sum of the numbers. This is both easy and correct.
No huzz no fuzz.. and you kill the buzz.. :P
I hope that will help.
Best Regards