Java Byte Array to Hex bytesToUnsignedHexes(byte[] bytes)

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

Description

bytes To Unsigned Hexes

License

Apache License

Declaration

public static String[] bytesToUnsignedHexes(byte[] bytes) 

Method Source Code

//package com.java2s;
/***//w ww .j  av a  2s.c o  m
  Copyright (c) 2012 sprogcoder <sprogcoder@gmail.com>
      
  Licensed under the Apache License, Version 2.0 (the "License"); you may
  not use this file except in compliance with the License. You may obtain
  a copy of the License at
      
http://www.apache.org/licenses/LICENSE-2.0
    
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 */

public class Main {
    public static String[] bytesToUnsignedHexes(byte[] bytes) {
        String[] hexValues = new String[bytes.length];
        for (int i = 0; i < bytes.length; i++) {
            hexValues[i] = Integer.toHexString(bytes[i] & 0xFF);
        }

        return hexValues;
    }
}

Related

  1. bytesToHex(final byte[] bytes)
  2. bytesToHex(final byte[] bytes)
  3. bytesToHex(final byte[] bytes, final boolean toLowerCase)
  4. bytesToHex(final byte[] bytes, final int position, final int length)
  5. bytesToHex(StringBuffer buff, byte[] src, int start, int end)
  6. byteToBcd(byte src)
  7. byteToHex(byte b)
  8. byteToHex(byte b)
  9. byteToHex(byte b[])