# ByteArrayUtils (sshj 0.4.0 API)
Date: 2011-06-06

## net.schmizz.sshj.common
Class ByteArrayUtils

    java.lang.Object
      net.schmizz.sshj.common.ByteArrayUtils

    public class ByteArrayUtils

extends Object

Utility functions for byte arrays.

Constructor Summary
`ByteArrayUtils()`

Method Summary
`static byte[]` `copyOf(byte[] array)`
`static boolean` `equals(byte[] a1, byte[] a2)` Check whether two byte arrays are the equal.
`static boolean` `equals(byte[] a1, int a1Offset, byte[] a2, int a2Offset, int length)` Check whether some part or whole of two byte arrays is equal, for `length` bytes starting at some offset.
`static String` `printHex(byte[] array)` Get a hexadecimal representation of `array`, with each octet separated by a space.
`static String` `printHex(byte[] array, int offset, int len)` Get a hexadecimal representation of a byte array starting at `offset` index for `len` bytes, with each octet separated by a space.
`static String` `toHex(byte[] array)` Get the hexadecimal representation of a byte array.
`static String` `toHex(byte[] array, int offset, int len)` Get the hexadecimal representation of a byte array starting at `offset` index for `len` bytes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ByteArrayUtils

    public ByteArrayUtils()

Method Detail

### equals

    public static boolean equals(byte[] a1,
                                 byte[] a2)

  Check whether two byte arrays are the equal.

  Parameters:
    `a1` -
    `a2` -
  Returns:
    `true` or `false`

### equals

    public static boolean equals(byte[] a1,
                                 int a1Offset,
                                 byte[] a2,
                                 int a2Offset,
                                 int length)

  Check whether some part or whole of two byte arrays is equal, for `length` bytes starting at some offset.

  Parameters:
    `a1` -
    `a1Offset` -
    `a2` -
    `a2Offset` -
    `length` -
  Returns:
    `true` or `false`

### printHex

    public static String printHex(byte[] array)

  Get a hexadecimal representation of `array`, with each octet separated by a space.

  Parameters:
    `array` -
  Returns:
    hex string, each octet delimited by a space

### printHex

    public static String printHex(byte[] array,
                                  int offset,
                                  int len)

  Get a hexadecimal representation of a byte array starting at `offset` index for `len` bytes, with each octet separated by a space.

  Parameters:
    `array` -
    `offset` -
    `len` -
  Returns:
    hex string, each octet delimited by a space

### toHex

    public static String toHex(byte[] array)

  Get the hexadecimal representation of a byte array.

  Parameters:
    `array` -
  Returns:
    hex string

### toHex

    public static String toHex(byte[] array,
                               int offset,
                               int len)

  Get the hexadecimal representation of a byte array starting at `offset` index for `len` bytes.

  Parameters:
    `array` -
    `offset` -
    `len` -
  Returns:
    hex string

### copyOf

    public static byte[] copyOf(byte[] array)

Copyright © 2009-2011. All Rights Reserved.