Hi i have a problem here im reading 2 int values f and digit from a user and i want to count the position of the number he input in a reverse order starting from 1. i Kept getting -1 from this. I think the problem is because of INT mismatch with String?Or can i use indexOfSubList? how can i implement it
Code:public static int pos(int f, int digit){ StringBuffer phrase = new StringBuffer(f); phrase.reverse(); String x=Integer.toString(digit); int firstoccur = phrase.indexOf(x); // find where the Digit x first occurs return firstoccur;




Reply With Quote