Java Byte Array Print printByteHexEncoded(byte b)

Here you can find the source of printByteHexEncoded(byte b)

Description

print Byte Hex Encoded

License

Apache License

Declaration

public static String printByteHexEncoded(byte b) 

Method Source Code

//package com.java2s;
/*//from w ww. j  a v  a 2  s .c om
 * Copyright (C) 2015 Synchronoss Technologies
 *
 * 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 printByteHexEncoded(byte b) {
        return String.format("0x%02x", b & 0xff);
    }
}

Related

  1. printByteArray(byte[] bytes)
  2. printByteArray(byte[] bytes)
  3. printByteArray(byte[] input)
  4. printByteArrayAsChars(byte[] bytes)
  5. printByteArrayToHex(byte[] byteArray, int length)
  6. printBytes(byte[] ba)
  7. printBytes(byte[] buffer, int start, int length)
  8. printBytes(byte[] bytes)
  9. printBytes(byte[] bytes)