Example usage for java.lang ArithmeticException toString

List of usage examples for java.lang ArithmeticException toString

Introduction

In this page you can find the example usage for java.lang ArithmeticException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:com.photon.phresco.nativeapp.eshop.activity.ProductReviewActivity.java

private void getAverage() {

    int reviewRatingsOneValue = 0, reviewRatingsTwoValue = 0, reviewRatingsThreeValue = 0,
            reviewRatingsFourValue = 0, reviewRatingsFiveValue = 0;

    ProductReviewRatings ratings = productReview.getRatings();
    List<ProductReviewRating> productReviewRatingObj = ratings.getRating();
    try {//from   w  w w .  j  a  v a2s .  c om
        for (ProductReviewRating productReviewRating : productReviewRatingObj) {

            if (productReviewRating.getKey() == REVIEW_RATING_ONE) {
                reviewRatingsOneValue = productReviewRating.getValue();
            }
            if (productReviewRating.getKey() == REVIEW_RATING_TWO) {
                reviewRatingsTwoValue = productReviewRating.getValue();
            }
            if (productReviewRating.getKey() == REVIEW_RATING_THREE) {
                reviewRatingsThreeValue = productReviewRating.getValue();
            }
            if (productReviewRating.getKey() == REVIEW_RATING_FOUR) {
                reviewRatingsFourValue = productReviewRating.getValue();
            }
            if (productReviewRating.getKey() == REVIEW_RATING_FIVE) {
                reviewRatingsFiveValue = productReviewRating.getValue();
            }
        }
        totalRatingValue = (reviewRatingsOneValue + reviewRatingsTwoValue + reviewRatingsThreeValue
                + reviewRatingsFourValue + reviewRatingsFiveValue);
        PhrescoLogger.info(TAG + " - getAverage  -: " + totalRatingValue);
    } catch (ArithmeticException ex) {
        PhrescoLogger.info(TAG + " - getAverage  -: " + ex.toString());
    }
}