I writing the following method:
public int count(int x){
//method contents
}
The parameter x must be between 0 and 10, although anyone using this code wouldn't have an issue as anyone using this method would never have an x which does not fulfill the requirements. Catching and handling checked exceptions could be a bit tedious due to the number of times the "count" method would be called. What is the best way to enforce x is always between 0 and 10: checked exception, unchecked exception, or assertion?