Java Binary Encode toBinaryString(byte... bytes)

Here you can find the source of toBinaryString(byte... bytes)

Description

to Binary String

License

Open Source License

Declaration

public static String toBinaryString(byte... bytes) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2018 Arrow Electronics, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License 2.0
 * which accompanies this distribution, and is available at
 * http://apache.org/licenses/LICENSE-2.0
 *
 * Contributors:/*from  w  ww.ja v  a2 s  .com*/
 *     Arrow Electronics, Inc.
 *******************************************************************************/

public class Main {
    public static String toBinaryString(byte... bytes) {
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            if (sb.length() > 0) {
                sb.append(' ');
            }
            sb.append(Integer.toBinaryString(256 + b));
        }
        return sb.toString();
    }
}

Related

  1. toBinaryIntArray(byte[] bytes, int bitOffset, int bitCount)
  2. toBinaryName(String className)
  3. toBinaryString(boolean[] array)
  4. toBinaryString(byte b)
  5. toBinaryString(byte b)
  6. toBinaryString(byte[] array)
  7. toBinaryString(byte[] bytes)
  8. toBinaryString(byte[] bytes)
  9. toBinaryString(byte[] bytes, int bitSize)