You can change a while loop to a do-while loop by moving the condition check to the end. The body remains the same, but do-while ensures the code runs at least once:
int i = 1;
do {
    System.out.println(i);
    i++;
} while (i <= 5);
So the only difference is when the condition is checked — while checks first, do-while checks after execution.
Learn more: https://youtu.be/lA4q9UZR53c?si=lO2ks5wwI37BZL3n