宿題のために、配列を並べ替えることができるメソッドを書く必要があります。並べ替えメソッドはできるだけ効率的でなければなりません。
- 配列の先頭には、4 で割り切れるすべての数値が表示されます。
 - 4 で割り、余りが 1 になるすべての数字が続きます。
 - 4 で割り、余りが 2 になるすべての数字が続きます。
 - 配列の最後には、他のすべての数値 (残りの 3 で 4 で除算される数値) があります。
 
このセットを試してみました 4 つのポインター: 
2 つのポインター 最初は 0 と 1
の残り 2 と 3 の残りの配列の最後の 2 つのポインター
これは私がこれまでに見つけたものです(もちろん問題があります)、助けていただきありがとうございます!
public static void sortByFour (int[] arr)
{
    int temp;
    int noRemainderIndex = 0;
    int remainder1Index = 1;
    int remainder2Index = arr.length - 2;
    int remainder3Index = arr.length - 1;
    for (int i = 0; i < arr.length; i++)
    {
        if (arr[i] % 4 == 0)
        {
            temp = arr[noRemainderIndex];
            arr[noRemainderIndex] = arr[i];
            arr[i] = temp;
            noRemainderIndex++;
            remainder1Index++;
        }
        else if (arr[i] % 4 == 1)
        {
            temp = arr[remainder1Index];
            arr[remainder1Index] = arr[i];
            arr[i] = temp;
            remainder1Index++;
        }
        else if (arr[i] % 4 == 2)
        {
            temp = arr[remainder2Index];
            arr[remainder2Index] = arr[i];
            arr[i] = temp;
            remainder2Index--;
        }
        else if (arr[i] % 4 == 3)
        {   
            temp = arr[remainder3Index];
            arr[remainder3Index] = temp = arr[i];
            arr[i] = temp;
            remainder3Index--;
            remainder2Index--;
        }
    }