The method sort give object array using the attribute having number value. The array objects will be sorted in ascending order by default.
It expects that all the array elements must have the given attribute.
542623
public static function sortObjectArrayByNumber( $array, $attribute, $asc = true ) {

		uasort( $array, function( $item1, $item2 ) use ( $attribute, $asc ) {

			if( $asc ) {

				return $item1->$attribute > $item2->$attribute;
			}
			else {

				return $item1->$attribute < $item2->$attribute;
			}
		});

		return $array;
	}
103277
public static void sortDescending(byte[] byteArray) {
        int index = 0;
        byte value = 0;
        
        for(int i = 1; i < byteArray.length; i++) {
            index = i;
            value = byteArray[index];
            
            while(index > 0 && value > byteArray[index - 1]) {
                byteArray[index] = byteArray[index - 1];
                
                index--;
            }
            
            byteArray[index] = value;
        }
    }
1375032
public static int[] Argsort(final float[] array, final boolean ascending) {
        Integer[] indexes = new Integer[array.length];
        for (int i = 0; i < indexes.length; i++) {
            indexes[i] = i;
        }
        Arrays.sort(indexes, new Comparator<Integer>() {
            @Override
            public int compare(final Integer i1, final Integer i2) {
                return (ascending ? 1 : -1) * Float.compare(array[i1], array[i2]);
            }
        });
        return asArray(indexes);
    }
910985
function(obj, func) {
		// define default sort function - by key
		if (!func) func = function(a, b) {return a.key > b.key;};

		// convert object to array
		var arr = _.toArray(obj);

		// sort array using function
		arr.sort(func);

		// convert array back to object
		_.deleteAll(obj);
		_.fromArray(arr, obj);

		// return obj
		return obj;
	}
501682
protected Integer findOrder(Object obj) {
		// Check for regular Ordered interface
		Integer order = super.findOrder(obj);
		if (order != null) {
			return order;
		}

		// Check for @Order annotation on various kinds of elements
		if (obj instanceof Class) {
			return OrderUtils.getOrder((Class) obj);
		}
		else if (obj instanceof Method) {
			Order ann = AnnotationUtils.findAnnotation((Method) obj, Order.class);
			if (ann != null) {
				return ann.value();
			}
		}
		else if (obj instanceof AnnotatedElement) {
			Order ann = AnnotationUtils.getAnnotation((AnnotatedElement) obj, Order.class);
			if (ann != null) {
				return ann.value();
			}
		}
		else if (obj != null) {
			return OrderUtils.getOrder(obj.getClass());
		}

		return null;
	}
1036272
function orderObject (unordered) {
  const ordered = {}
  if (typeof unordered !== 'object' || unordered == null || Array.isArray(unordered)) return unordered
  Object.keys(unordered).sort().forEach(function (key) {
    ordered[key] = ((typeof unordered[key] === 'object') && !Array.isArray(unordered[key])) ? orderObject(unordered[key]) : unordered[key]
  })
  return ordered
}
1347541
@Deprecated
    public static <T> void sort(T[] array, int size, Comparator<? super T> comparator)
    {
        if (comparator == null)
        {
            Arrays.sort(array, 0, size); // handles case size < 2 in Java 8 ComparableTimSort
        }
        else
        {
            Arrays.sort(array, 0, size, comparator); // handles case size < 2 in Java 8 TimSort
        }
    }
980689
def sort
      objects.values.each do |object|
        SORTABLE_ITEMS.select { |key| object.has_key?(key) }.each do |key|
          object[key].sort_by!(&method(:comparator))
        end
      end
      project
    end
364297
public static void sort(byte[] byteArray) {
        int index = 0;
        byte value = 0;
        
        for(int i = 1; i < byteArray.length; i++) {
            index = i;
            value = byteArray[index];
            
            while(index > 0 && value < byteArray[index - 1]) {
                byteArray[index] = byteArray[index - 1];
                
                index--;
            }
            
            byteArray[index] = value;
        }
    }
947992
function sort(array, minValue, maxValue) {
  if (array.length === 0) {
    return array;
  }

  var rangeSize = maxValue - minValue;
  var buckets = new Array(rangeSize);
  var sortedIndex = 0;
  var i;

  for (i = 0; i < array.length; i++) {
    // Change the value to a zero-based index
    var bucketIndex = array[i] - minValue;
    if (!buckets[bucketIndex]) {
      buckets[bucketIndex] = 0;
    }
    buckets[bucketIndex]++;
  }

  for (i = 0; i < buckets.length; i++) {
    while (buckets[i] > 0) {
      // Change the index to the correct value
      array[sortedIndex++] = i + minValue;
      buckets[i]--;
    }
  }

  return array;
}
1073464
public static void sortArray(int[] array) {

        boolean swapped;

        do {
            swapped = false;

            for (int i = 0; i < array.length - 1; i++) {
                if (array[i] > array[i + 1]) {
                    int temp = array[i + 1];

                    array[i + 1] = array[i];
                    array[i]     = temp;
                    swapped      = true;
                }
            }
        } while (swapped);
    }
315417
def _sortAttributeValue(self, offset):
        
        if self._currentResults:
            pageStart = (self._currentResults[offset][
                self.currentSortColumn.attributeID],
                         self._currentResults[offset][
                    '__item__'].storeID)
        else:
            pageStart = None
        return pageStart
232847
public void sortObject( SortableParameter_F32 input[] , int start , int length ) {

		for( int i = 0; i < histIndexes.size; i++ ) {
			histObjs[i].reset();
		}

		for( int i = 0; i < length; i++ ) {
			int indexInput = i+start;
			SortableParameter_F32 p = input[indexInput];
			int discretized = (int)((p.sortValue-minValue)/divisor);
			histObjs[discretized].add(p);
		}

		// over wrist the input data with sorted elements
		int index = start;
		for( int i = 0; i < histIndexes.size; i++ ) {
			FastQueue<SortableParameter_F32>  matches = histObjs[i];
			for( int j = 0; j < matches.size; j++ ) {
				input[index++] = matches.data[j];
			}
		}
	}
1292520
public static Object toWrapperArray(Object array) {
    if (!array.getClass().isArray()) {
      throw new IllegalArgumentException("Must give array object.");
    }
    if (isPrimitiveArray(array.getClass())) {
      int length = Array.getLength(array);
      Object newArray = Array.newInstance(toWrapper(array.getClass().getComponentType()), length);
      for (int i = 0; i < length; i++) {
        Array.set(newArray, i, toWrapper(Array.get(array, i)));
      }
      return newArray;
    } else if (array.getClass().getComponentType().isArray()) {
      int length = Array.getLength(array);
      Object newArray = Array.newInstance(toWrapperArray(array.getClass().getComponentType()), length);
      for (int i = 0; i < length; i++) {
        Array.set(newArray, i, toWrapperArray(Array.get(array, i)));
      }
      return newArray;
    }
    return array;
  }
924339
def order_by(self, sort_key=None):
        
        if sort_key is not None:
            sort_attr = re.match(r'(-)?(.*)$', sort_key).group(2)
            if sort_attr not in self._valid_sort_attrs:
                raise ClientValidationError("Invalid ordering attribute: %s" % sort_key)

        q = self._clone()
        q._order_by = sort_key
        return q
1183161
function sortObject(obj) {
  assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj));
  assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj));

  var sortedKeys = _.keys(obj).sort();
  var sortedObjs = [];

  _.each(sortedKeys, function(key) {
    var val = {};
    val[key] = obj[key];
    sortedObjs.push(val);
  });

  return sortedObjs;
}
360998
protected int getNumAttr() {
        int num = element.tree.elemNodeNumAttributes[element.tree.nodeRepID[element.node]];
        return num >= 0 ? num : 0;
    }