package me.jesensky.dan.playertracker.net;


import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;

public final class NetUtils {
    private NetUtils(){
    }

    public static byte[] byteListToArray(List<Byte> bytes){
        byte[] b = new byte[bytes.size()];
        for(int i = 0; i < b.length; i++)
            b[i] = bytes.get(i);
        return b;
    }

    public static byte[] getMD5Hash(byte[] b){
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.update(b);
            return md5.digest();
        }catch(NoSuchAlgorithmException e){
            //ignore, md5 is always there
        }
        return null;
    }

    public static byte[] stringToBytes(String s){
        try {
            return s.getBytes("UTF-8");
        }catch(UnsupportedEncodingException e){
            //if your computer does not have UTF-8, there's something severely wrong with it, or you're running windows 95.
        }
        return null;
    }
}

@@ -75,32 +75,65 @@
 odingException;%0A
+import java.nio.charset.Charset;%0A
 import java.secu
@@ -1110,11 +1110,240 @@
 l;%0A    %7D
+%0A%0A    public static String byteToString(byte%5B%5D b)%7B%0A        try%7B%0A            return new String(b, %22UTF-8%22);%0A        %7Dcatch(UnsupportedEncodingException e)%7B%0A            //stop running windows 95%0A        %7D%0A        return null;%0A    %7D
 %0A%7D%0A

Add utility of bytes to string in netutils