getValue method

double getValue(
  1. double value,
  2. double max
)

Implementation

double getValue(double value, double max) {
  if (value < 0) {
    return 0;
  } else if (value > max) {
    return max;
  } else {
    return value;
  }
}