public void incProb(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;
}

public void incProb ( 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 ; }
increments the stored probability that a sample belongs to a given category
