Java AtomicReference pack(int count, Object[] array, AtomicReference edit, int idx)

Here you can find the source of pack(int count, Object[] array, AtomicReference edit, int idx)

Description

pack

License

Open Source License

Declaration

public static Object[] pack(int count, Object[] array, AtomicReference<Thread> edit, int idx) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.atomic.AtomicReference;

public class Main {
    public static Object[] pack(int count, Object[] array, AtomicReference<Thread> edit, int idx) {
        Object[] newArray = new Object[2 * (count - 1)];
        int j = 1;
        int bitmap = 0;
        for (int i = 0; i < idx; i++)
            if (array[i] != null) {
                newArray[j] = array[i];/*  w  ww . j  a  v  a  2 s . c  o m*/
                bitmap |= 1 << i;
                j += 2;
            }
        for (int i = idx + 1; i < array.length; i++)
            if (array[i] != null) {
                newArray[j] = array[i];
                bitmap |= 1 << i;
                j += 2;
            }
        Object[] returnArray = new Object[2];
        returnArray[0] = bitmap;
        returnArray[1] = newArray;
        return returnArray;
    }
}

Related

  1. getIdentityName(final String identityType, final String displayName, final String attribute, final String attribute2, final int uniqueUserID, final AtomicReference outResolvableName, final AtomicReference outDisplayableName)
  2. getSplineCoefficients(int n, float x)
  3. isTerminated(AtomicReference field)
  4. length(AtomicReferenceArray buf)
  5. mergeProperties(Properties... properties)
  6. runInThread(final Runnable runnable)
  7. runInThread(final Runnable runnable)