How to get the last 5 values from the RRD4J?

I use this to filter faulty values, but changed the filter criteria if the difference is too big.