while(!foundprime) 是指foundprime为false时执行循环体,也就是说循环体的条件是foundprime为false。而你在之前定义foundprime为false,所以循环体先执行,当执行到foundprime=!founddivider; 时foundprime值为true,循环停止
boolean foundprime=false;
while(!foundprime)
{
long divider=2;
boolean founddivider=(primecandidate%divider)==0;
divider=3;
-------------------
控制程序,!foundprime代表ture 程序执行
直道运行到 foundprime=!founddivider;
使foundprime为true时推出循环