Check out example codes for "loop while in java". It will help you in understanding the concepts better.

Code Example 1

while(i < 5) //while i < 5 stay in the loop
{
  System.out.print(i);
  i++;
}
/*
	do someting
	change variable
    call methods
    etc...
*/

Learn ReactJs, React Native from akashmittal.com