Example usage for org.apache.commons.lang ArrayUtils toString

List of usage examples for org.apache.commons.lang ArrayUtils toString

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils toString.

Prototype

public static String toString(Object array) 

Source Link

Document

Outputs an array as a String, treating null as an empty array.

Usage

From source file:org.acoustid.util.BitStreamWriterTest.java

public void testTwoBytesSplit() throws IOException {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    DataOutputStream dataOutput = new DataOutputStream(output);

    BitStreamWriter writer = new BitStreamWriter(dataOutput);
    writer.write(0, 3);//from   ww  w  .  j ava2  s.co m
    writer.write(1, 3);
    writer.write(2, 3);
    writer.write(3, 3);
    writer.flush();

    byte[] expected = { -120, 6 };
    assertEquals(ArrayUtils.toString(expected), ArrayUtils.toString(output.toByteArray()));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testOneItemOneBit() throws IOException {
    int[] fingerprint = { 1 };
    byte[] expected = { 0, 0, 0, 1, 1 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testOneItemThreeBits() throws IOException {
    int[] fingerprint = { 7 };
    byte[] expected = { 0, 0, 0, 1, 73, 0 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testOneItemOneBitExcept() throws IOException {
    int[] fingerprint = { 1 << 6 };
    byte[] expected = { 0, 0, 0, 1, 7, 0 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testOneItemOneBitExcept2() throws IOException {
    int[] fingerprint = { 1 << 8 };
    byte[] expected = { 0, 0, 0, 1, 7, 2 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testTwoItems() throws IOException {
    int[] fingerprint = { 1, 0 };
    byte[] expected = { 0, 0, 0, 2, 65, 0 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintCompressorTest.java

public void testTwoItemsNoChange() throws IOException {
    int[] fingerprint = { 1, 1 };
    byte[] expected = { 0, 0, 0, 2, 1, 0 };
    assertEquals(ArrayUtils.toString(expected),
            ArrayUtils.toString(FingerprintCompressor.compress(fingerprint)));
}

From source file:org.acoustid.util.FingerprintDecompressorTest.java

public void testOneItemOneBit() throws IOException, IncompatibleFingerprintVersion {
    int[] expected = { 1 };
    byte[] data = { 0, 0, 0, 1, 1 };
    assertEquals(ArrayUtils.toString(expected), ArrayUtils.toString(FingerprintDecompressor.decompress(data)));
}

From source file:org.acoustid.util.FingerprintDecompressorTest.java

public void testOneItemThreeBits() throws IOException, IncompatibleFingerprintVersion {
    int[] expected = { 7 };
    byte[] data = { 0, 0, 0, 1, 73, 0 };
    assertEquals(ArrayUtils.toString(expected), ArrayUtils.toString(FingerprintDecompressor.decompress(data)));
}

From source file:org.acoustid.util.FingerprintDecompressorTest.java

public void testOneItemOneBitExcept() throws IOException, IncompatibleFingerprintVersion {
    int[] expected = { 1 << 6 };
    byte[] data = { 0, 0, 0, 1, 7, 0 };
    assertEquals(ArrayUtils.toString(expected), ArrayUtils.toString(FingerprintDecompressor.decompress(data)));
}