Java String Decode decode(String bytes)

Here you can find the source of decode(String bytes)

Description

decode

License

Apache License

Declaration

public static String decode(String bytes) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;

public class Main {
    private static String hexString = "0123456789ABCDEF";

    public static String decode(String bytes) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length() / 2);

        for (int i = 0; i < bytes.length(); i += 2)
            baos.write(hexString.indexOf(bytes.charAt(i)) << 4 | hexString.indexOf(bytes.charAt(i + 1)));
        return new String(baos.toByteArray());
    }//from   ww w .j  a  v  a 2  s.  c  o m
}

Related

  1. decode(String cipherText)
  2. decode(String in)
  3. decode(String name)
  4. decode(String s)