Is it possible to sort it respecting the fact that each cluster of 32 bytes form a record?
Possible? algorithmically yes, but not using any of the (current) JDK's sorting functionality - unless you do some preprocessing first (the trivial path: constructing a new array of n
objects and sorting it instead), which is very likely to end up costing more (performance-wise) than writing your own sorting implementation.