Java ASCII from toAscii(byte[] b)

Here you can find the source of toAscii(byte[] b)

Description

to Ascii

License

Open Source License

Declaration

public static String toAscii(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toAscii(byte[] b) {

        StringBuffer s = new StringBuffer();
        if (b == null) {
            return "";
        }//from   ww  w  . j  av  a 2s .  c o  m
        for (int i = 0; i < b.length; i++) {
            if (b[i] != 0) {
                char in = (char) b[i];
                s.append(in);
            }
        }
        return s.toString();
    }
}

Related

  1. toAscii(byte[] ba)
  2. toAscii(char ch)
  3. toAscii(char source)
  4. toAscii(int i, boolean reversed)