Java List Sort sortByByteDeux(List symbolAL, int delimiter)

Here you can find the source of sortByByteDeux(List symbolAL, int delimiter)

Description

sort By Byte Deux

License

Apache License

Declaration

public static ArrayList<ArrayList<Character>> sortByByteDeux(List<Character> symbolAL, int delimiter) 

Method Source Code


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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static ArrayList<ArrayList<Character>> sortByByteDeux(List<Character> symbolAL, int delimiter) {

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

        for (int i = 0; i < symbolAL.size(); i += 2) {
            String byteS = symbolAL.get(i).toString() + symbolAL.get(i + 1).toString();

            int tempI = Integer.parseInt(byteS, 16);

            if (tempI > delimiter) {
                bucketTwoAL.add(symbolAL.get(i));
                bucketTwoAL.add(symbolAL.get(i + 1));
            } else {
                bucketOneAL.add(symbolAL.get(i));
                bucketOneAL.add(symbolAL.get(i + 1));
            }//from  w ww.j  ava 2 s  .  co  m

        }

        ArrayList<ArrayList<Character>> returnL = new ArrayList<ArrayList<Character>>();
        returnL.add(bucketOneAL);
        returnL.add(bucketTwoAL);
        return returnL;

    }
}

Related

  1. sort(Set list, Comparator comparator)
  2. sort(String prefix, int[] a, List list)
  3. sortAndFormat(List stringList)
  4. sortAndReturn(final List list)
  5. sortBy(List> list, final Map orderBy)
  6. sortByClosestMatch(final List strings, final String toMatch)
  7. sortByLength(List li, String text)
  8. sortByLength(List list, final boolean ascending)
  9. sortByOccurencies(List lsSame)