If you want an algorithm that will sort the array of long type, try this one:
1. get first element, compare it to next element,
if the next element is lower, interchange the two of them.
something...