Quality classification of grain using a sensor array and pattern recognition