Java Array Remove removeId(byte[] in, Integer id)

Here you can find the source of removeId(byte[] in, Integer id)

Description

remove Id

License

Open Source License

Declaration

public static byte[] removeId(byte[] in, Integer id) 

Method Source Code


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

import java.util.ArrayList;
import java.util.Arrays;

import java.util.List;

public class Main {
    public static byte[] removeId(byte[] in, Integer id) {
        byte[] out = null;
        if (in != null) {
            String[] idArr = (new String(in)).split(",");
            List<String> idList = new ArrayList<String>(Arrays.asList(idArr));
            if (idList.remove(id.toString()) && idList.size() > 0) {
                String idStr = idList.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(" ", "")
                        .trim();/*from w ww.j  a  v a 2 s  .  c  o m*/
                out = idStr.getBytes();
            }
        }
        return out;
    }
}

Related

  1. removeFlag(String[] options, String flag)
  2. removeFlagsFromArgs(String[] args)
  3. removeFrom(double[] source, int idx)
  4. removeFromArray(String remove, String array[])
  5. removeFromArray(String[] oldArray, String stringToRemove)
  6. removeIndex(String[] args, int index)
  7. removeIndex(T[] array, int index)
  8. removeLast(byte[] target, int end)
  9. removeLowScore(int[] array)