Here you can find the source of byteArrayToArrayList(byte[] byteArray)
Parameter | Description |
---|---|
byteArray | array of bytes to convert |
public static ArrayList<Byte> byteArrayToArrayList(byte[] byteArray)
//package com.java2s; /**/*from www . j a v a 2 s . co m*/ * (C) 2011-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * */ import java.util.ArrayList; public class Main { /** * Converts the given array of bytes into a Java ArrayList * * @param byteArray * array of bytes to convert * @return an ArrayList containing the given byteArray data */ public static ArrayList<Byte> byteArrayToArrayList(byte[] byteArray) { return byteArrayToArrayList(byteArray, 0); } /** * Converts the given array of bytes into a Java ArrayList starting from the * given offset * * @param byteArray * array of bytes to convert * @param offset * where to start conversion from * @return an ArrayList containing the given byteArray data */ public static ArrayList<Byte> byteArrayToArrayList(byte[] byteArray, int offset) { ArrayList<Byte> list = new ArrayList<Byte>(byteArray.length); for (int i = offset; i < byteArray.length; i++) { list.add(Byte.valueOf(byteArray[i])); } return list; } }