Wow. Lot of sort out.
First, there is a thread about color sorting:
Sort 2d array. There is also a thread about counting colors in an image.
"
converting it to an array i could sort"
You can sort ArrayList too. I started to write a Hacks entry about sorting arrays and collections, as the topic surfaces often. I should finish it... :-)
"
The code is a following, but is veeeery slow."
Yes, append() is handy, but extremely slow on large arrays: each time you use it, it copies the entire array to a new one just one unit larger...
"
Are ArrayList only for objects"
Yes, that's an irritating limitation of Java Collections. They made objects boxing primitive types mostly for this usage (Integer, Float, Boolean, etc.). Java 1.5 introduced autoboxing to reduce the pain. But it is still costly (size and time). That's why arrays are still useful: small (minimal size), fast access. Good when you know the final size.
"
I'm trying to count how many different colors are in pixels array."
Actually, you don't need sorting and such. I would use a HashMap with (boxed) color as keys and occurrence number (boxed too) as value: take color, get it from HashMap. If null, not there yet, put (color, 1) in map. If there, put (color, nb + 1).