Create a do/while loop

How to Create a do/while loop

The do-while statement continually executes a block of statements while a particular condition is true. A do-while evaluates its expression at the bottom of the loop. Therefore, the statements within the do block are always executed at least once. Write the code to be executed in the do statement and then the expression to be checked in the while block.

Structure:
do {
     //statement(s) to run
}
while (expression is true);

1. Create an Android project, if you don't already have one.

2. In the MainActivity.java file in the onCreate method, declare an integer named i and set it to 0.

3. The following do/while will display a Toast. Then it will increment i by 1. The while will test if i is less than 5. When it hits 5, it will exit the loop and continue with the next line of code after the while.

do {
    Toast.makeText(getBaseContext(), "Number: " + i, Toast.LENGTH_SHORT).show();
    i = i++; //increment i by 1
}
while(i < 5);

4. Compile and run! 

Resources:
http://examples.javacodegeeks.com/java-basics/simple-dowhile-loop/