Here you can find the source of convertByteToCharArray(byte aByte)
static public char[] convertByteToCharArray(byte aByte)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:// ww w . ja va2 s .c o m * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { static public char[] convertByteToCharArray(byte aByte) { char charArray[] = new char[2]; int val = aByte; if (val < 0) val += 256; charArray[0] = Character.forDigit(val / 16, 16); charArray[1] = Character.forDigit(val % 16, 16); return charArray; } }