private float normalizeRating(float rating){
  if (rating < 0) {
    Log.w("SimpleRatingBar",String.format("Assigned rating is less than 0 (%f < 0), I will set it to exactly 0",rating));
    return 0;
  }
 else   if (rating > numberOfStars) {
    Log.w("SimpleRatingBar",String.format("Assigned rating is greater than numberOfStars (%f > %d), I will set it to exactly numberOfStars",rating,numberOfStars));
    return numberOfStars;
  }
 else {
    return rating;
  }
}

private float normalizeRating ( float rating ) { if ( rating < 0 ) { Log . w ( "SimpleRatingBar" , String . format ( "Assigned rating is less than 0 (%f < 0), I will set it to exactly 0" , rating ) ) ; return 0 ; } else if ( rating > numberOfStars ) { Log . w ( "SimpleRatingBar" , String . format ( "Assigned rating is greater than numberOfStars (%f > %d), I will set it to exactly numberOfStars" , rating , numberOfStars ) ) ; return numberOfStars ; } else { return rating ; } }
normalizes rating passed by argument between 0 and numberofstars .
