大佬们这个代码中如何使输入stop之后跳出while循环

            boolean m=true;
            while (m) {
                System.out.println("请输入要加密的数据,输入stop就跳出while");
                String s =input.next();
                BigInteger y=new BigInteger(s);
                BigInteger s1=paillier.En(y);
                System.out.println(s+"加密的结果是"+s1);  

加一段代码块:

if (s == "stop")
{
    break;
}

在 String s = input.next(); 的下一行加入

String s =input.nextLine();
if (s.equals("stop")) break;

注意,不要用==,要用equals

String s =input.next();下面加上

if(s==“stop”){
    break;
}