public static int changeNumber (int num) { if(num == 0)return 2; int temp = num; int count = 0; int flag = 1; int base = 0; while(temp!=0){ if((temp&flag) == 0){ count++; } if(count==2)break; temp = temp>>>1; base++; } if(count == 0)return (int) (num+Math.pow(2,base+1)); return (int) (num+Math.pow(2,base)); }
点赞 3

相关推荐

不愿透露姓名的神秘牛友
07-09 12:23
转人工😡
门口唉提是地铁杀:五次握手了
点赞 评论 收藏
分享
06-02 15:53
阳光学院 Java
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务