Java Byte Array Convert To bytesToPdu(byte[] bytes)

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

Description

bytes To Pdu

License

Apache License

Declaration

public static String bytesToPdu(byte[] bytes) 

Method Source Code

//package com.java2s;
//PduUtils is distributed under the terms of the Apache License version 2.0

public class Main {
    public static String bytesToPdu(byte[] bytes) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            sb.append(byteToPdu(bytes[i] & 0xFF));
        }/*  www.  j  ava 2 s .c om*/
        return sb.toString();
    }

    public static String byteToPdu(int b) {
        StringBuffer sb = new StringBuffer();
        String s = Integer.toHexString(b & 0xFF);
        if (s.length() == 1) {
            sb.append("0");
        }
        sb.append(s);
        return sb.toString().toUpperCase();
    }
}

Related

  1. bytesToIpString(byte[] bytes)
  2. bytesToLength(final byte bytes[])
  3. bytesToMac(byte[] bytes)
  4. bytesToMac(final byte[] bytes)
  5. bytesToNumber(byte[] buffer, int start, int length)
  6. bytesToSectors(long bytes)
  7. bytesToSignedInt(byte bb1, byte bb2)
  8. bytesToStore(int bits)
  9. bytesToStringAscii(byte[] bytes)