Here you can find the source of toObject(byte[] byteArray)
Parameter | Description |
---|---|
byteArray | a byte array. |
public static Byte[] toObject(byte[] byteArray)
//package com.java2s; /**//from www. j ava 2s . c o m * Copyright (c) 2011-2014 INRIA. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> **/ public class Main { /** * Converts an array of primitive bytes to objects. * * This method returns {@code null} for a {@code null} input array. * * @param byteArray * a byte array. * * @return a {@code Byte} array, {@code null} if null array input. */ public static Byte[] toObject(byte[] byteArray) { if (byteArray == null) { return null; } Byte[] box = new Byte[byteArray.length]; for (int i = 0; i < box.length; i++) { box[i] = byteArray[i]; } return box; } }