private static String decrypt(final int key, final String text) {
        String decryptedText = "";
        logger.log(Level.INFO, "Encrypted text: {0}", text);
        char temp[] = new char[text.length()];
        int c = 0;
        for (int level = 0; level < key; level++) {
            for (int n = 0; n < text.length() / (2 * key - 2) + 1; n++) {
                if (level != 0 && level != key - 1 && 2 * n * (key - 1) - level > -1) {
                    temp[2 * n * (key - 1) - level] = text.charAt(c++);
                }
                if (2 * n * (key - 1) + level < text.length()) {
                    temp[2 * n * (key - 1) + level] = text.charAt(c++);
                }
            }
        }
        for (int n = 0; n < text.length(); n++) {
            decryptedText += temp[n];
        }
        logger.log(Level.INFO, "Decrypted text: {0}", decryptedText);
        return decryptedText;
    }