public String[] getMessages(){
        if (length == 0){
            return null;
        }
        String[] res = new String[length];
        for (int i = 0; i < length; i++){
            res[i] = messages[i];
        }
        return res;
    }