package stego;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class btoS
{

    public btoS()
    {
    }

    public static String convertByteArrayToStringRepresentation(byte in[])
    {
        String out = "";
        for(int i = 0; i < in.length; i++)
        {
            out = (new StringBuilder(String.valueOf(out))).append(Byte.valueOf(in[i])).append(" ").toString();
        }

        out.trim();
        return out;
    }

    public static byte[] convertStringRepresentationToByteArray(String in)
        throws IOException
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        for(int i = 0; i < in.split(" ").length; i++)
        {
            out.write(Byte.parseByte(in.split(" ")[i]));
        }

        out.flush();
        return out.toByteArray();
    }
}
