When I add code to call your example it works as you expect:
public class MyClass
{
public static int index=0;
public static void getIndex()
{
index++;
System.out.println("Index:"+index);
if(index>10)
index=0;
}
public static void main(String[] args) {
for (int i = 0; i < 12; i++) {
getIndex();
}
}
}
printing:
Index:1
Index:2
Index:3
Index:4
Index:5
Index:6
Index:7
Index:8
Index:9
Index:10
Index:11
Index:1
to the console. So how you're calling this must be the problem.