Convert byte array to Ascii String - Android File Input Output

Android examples for File Input Output:Byte Array Convert

Description

Convert byte array to Ascii String

Demo Code

/**/*from  w w w  .j a  v  a2 s . c om*/
 * Source obtained from crypto-gwt. Apache 2 License.
 * https://code.google.com/p/crypto-gwt/source/browse/crypto-gwt/src/main/java/com/googlecode/
 * cryptogwt/util/ByteArrayUtils.java
 */
//package com.book2s;

public class Main {
    public static String toAsciiString(byte[] output) {
        char[] chars = new char[output.length];
        for (int i = 0; i < output.length; i++) {
            chars[i] = (char) output[i];
        }
        return new String(chars);
    }
}

Related Tutorials