How about converting it to an array, that way you could loop through it.



final String inputString = "java|21|new1|kkkk|eee|rrrr||dddd|dddd|ooooo|2073| |...