Here are two ways two achieve it.
WAY 1: As As you have to split two numbers by a special character you can use regex
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TrialClass
{
public static void main(String[] args)
{
Pattern p=Patternp = Pattern.compile("[0-9]+");
Matcher m=pm = p.matcher("004-034556");
while(m.find())
{
System.out.println(m.group());
}
}
}
WAY 2:Using Using the string split method
public class TrialClass
{
public static void main(String[] args)
{
String temp="004temp = "004-034556";
String [] arrString=temparrString = temp.split("-");
for(String splitString:arrString)
{
System.out.println(splitString);
}
}
}