public boolean hasOne(int n) { int lastdigit=0; while( n >0 ){ lastdigit=(n % 10); if(lastdigit==1) return true; n=n/10; } return false; }
http://codingbat.com/prob/p191212
hasOne
原文:http://www.cnblogs.com/youge-OneSQL/p/6403387.html