Java ASCII to String asciiToString(byte[] b, int off, int len)

Here you can find the source of asciiToString(byte[] b, int off, int len)

Description

ascii To String

License

Open Source License

Declaration

public static String asciiToString(byte[] b, int off, int len) 

Method Source Code

//package com.java2s;
/*/*from ww  w  .  ja v a2 s  .com*/
 * StringUtil.java  $Revision: 1.1 $ $Date: 2001/11/27 17:37:22 $
 *
 * Copyright (c) 2001 Huston Franklin.  All rights reserved.
 *
 * The contents of this file are subject to the Blocks Public License (the
 * "License"); You may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at http://www.beepcore.org/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 */

public class Main {
    public static String asciiToString(byte[] b, int off, int len) {
        char[] c = new char[len];

        for (int i = 0; i < len; ++i) {
            c[i] = (char) (b[off + i] & 0xff);
        }

        return new String(c);
    }
}

Related

  1. asciiBytesToString(byte[] val)
  2. ASCIIToChar(final int ascii)
  3. AsciiToChar(int asc)
  4. asciiToLowerCase(String s)
  5. asciiToString(byte ascii)
  6. asciiToString(int asciiCode)
  7. asciiTrimR(String str, int length)