Java List to Array asByteArray(final List l)

Here you can find the source of asByteArray(final List l)

Description

Return list of boxed bytes as a primitive array.

License

Open Source License

Parameter

Parameter Description
l list

Return

byte array

Declaration

public static byte[] asByteArray(final List<Byte> l) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**/*from  ww w .ja  v  a 2s  .  c o m*/
     * Return list of boxed bytes as a primitive array.
     *
     * @param l list
     * @return byte array
     */
    public static byte[] asByteArray(final List<Byte> l) {
        final byte[] a = new byte[l.size()];
        for (int i = 0; i < a.length; i++) {
            a[i] = l.get(i);
        }
        return a;
    }
}

Related

  1. asArray(List list)
  2. asArray(List list)
  3. asArrayList(E first, E... other)
  4. asArrayList(T... a)
  5. asBooleanArray(List list)
  6. asClassArray(List> list)
  7. convertStringListToArray(List list)
  8. convertStringListToArray(List list)
  9. convertToArray(final List> list)