code: public void setProb(int cat, double prob)
      {
          if(cat > probabilities.length)
              throw new IndexOutOfBoundsException("There are only " + probabilities.length + " posibilties, " + cat + " is invalid");
          else if(prob < 0 || Double.isInfinite(prob) || Double.isNaN(prob))
              throw new ArithmeticException("Only zero and positive values are valid, not " + prob);
          probabilities[cat] = prob;
      }
docs: Sets the probability that a sample belongs to a given category.
  @param cat the category
  @param prob the value to set, may be greater then one.
  @throws IndexOutOfBoundsException if a non existent category is specified
  @throws ArithmeticException if the value set is negative or not a number