Java Byte Array to Char bytesToChar(byte[] bytes)

Here you can find the source of bytesToChar(byte[] bytes)

Description

bytes To Char

License

Open Source License

Declaration

public static char bytesToChar(byte[] bytes) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2000, 2014 QNX Software Systems 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:/*w w w . java 2  s. co m*/
 *     QNX Software Systems - Initial API and implementation
 *     Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
 *     Patrick Chuong (Texas Instruments) -   Update CDT ToggleBreakpointTargetFactory enablement (340177)
 *     Marc Khouzam (Ericsson) - Support for dynamic printf (400628)
 *******************************************************************************/

public class Main {
    public static char bytesToChar(byte[] bytes) {
        try {
            return (char) Short.parseShort(new String(bytes), 16);
        } catch (RuntimeException e) {
        }
        return 0;
    }
}

Related

  1. bufferToChar(byte[] ioBuffer)
  2. bytesToChar(byte[] arr, int offset)
  3. bytesToChar(byte[] arr, int pos)
  4. bytesToChar(byte[] b)
  5. bytesToChar(byte[] bytes)
  6. bytesToChar(byte[] bytes)
  7. convertByteToChar(byte input)
  8. convertByteToChar(byte[] source, int srclen)