Java ArrayList Sort sortByNibble(ArrayList symbolAL, int delimiter)

Here you can find the source of sortByNibble(ArrayList symbolAL, int delimiter)

Description

sort By Nibble

License

Apache License

Declaration

public static void sortByNibble(ArrayList<Character> symbolAL, int delimiter) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

public class Main {
    public static void sortByNibble(ArrayList<Character> symbolAL, int delimiter) {

        ArrayList<Character> bucketOneAL = new ArrayList<Character>();
        ArrayList<Character> bucketTwoAL = new ArrayList<Character>();

        for (int i = 0; i < symbolAL.size(); i++) {
            int tempI = Integer.parseInt(symbolAL.get(i).toString(), 16);

            if (tempI > delimiter) {
                bucketTwoAL.add(symbolAL.get(i));
            } else {
                bucketOneAL.add(symbolAL.get(i));
            }//  w w  w .jav  a  2  s.  c o m

        }

        symbolAL.clear();
        symbolAL.addAll(bucketOneAL);
        symbolAL.addAll(bucketTwoAL);

    }
}

Related

  1. sortArray(ArrayList list)
  2. sortedPatterns(ArrayList patterns)
  3. sortImports(ArrayList imports)
  4. sortSignatures(ArrayList sList)
  5. SortStringList(ArrayList list)