Write a java program to find Sum of Digits in a String. By codebun Problem Solving 1 Comment. Write code to get the sum of all the digits present in the given string. Return the sum as the output. If there is no digit in the given string return -1 as output.. Write a Java program to Find the element position in a reversed string array.