import java.util.Arrays; public class Solution { public boolean isContinuous(int [] numbers) { if(numbers==null||numbers.length==0){ return false; } Arrays.sort(numbers); boolean result=false; //判断是否重复 for(int i=0;i<numbers.length-1;i++){ if(numbers[i]!=0&&numbers[i]==numbers[i+1]) return result; } //四个王 if(numbers[0]==0&&numbers[1]==0&&numbers[2]==0&&numbers[3]==0){ return result=true; } //三个王 if(numbers[0]==0&&numbers[1]==0&&numbers[2]==0){ if((numbers[4]-numbers[3])>0&&(numbers[4]-numbers[3])<5){ result=true; } return result; } //两个王 if(numbers[0]==0&&numbers[1]==0){ if((numbers[4]-numbers[2])>1&&(numbers[4]-numbers[2])<5){ result=true; } return result; } //一个王 if(numbers[0]==0){ if((numbers[4]-numbers[1])>2&&(numbers[4]-numbers[1])<5){ result=true; } return result; } //0个王 if((numbers[4]-numbers[0])==4){ result=true; } return result; } }