Other than all of the above suggestions, you can separate the four digit integer like;


int x=1234;

while(x/10!=0){
int temp=x%10;
x=x/10;
System.out.println(temp);
}