1. A method, comprising: defining dimensions comprising whole or partial fields in a packet header to be used for packet classification; generating a set of original rule bit vectors for each dimension, each bit in an original rule bit vector identifying a rule for handling packets based on a corresponding dimension value or range, each set of original rule bit vectors defining an original array; grouping the original arrays into one or more groups; optimizing rule bit vectors in at least one original array to produce an optimized array by zeroing out selected set bits such that rule bit vectors generated by cross-producting each of the original rule bit vectors and the optimized rule bit vectors of an original array with rule bit vectors for a array or arrays in an associated group will have the same highest priority bit set; and for each optimized array, cross-producting the optimized rule bit vectors with original or optimized rule bit vectors in the array or arrays of the optimized array's associated group to produce a cross-producted array.