public int getMyInt(int a,int b) { return(((double)a/(double)b)>(a/b)?a/b+1:a/b); } 调用: System.out.println(getMyInt(10,3));