Decode double encoded open or closed brackets in the input String.

@param input the String to decode double encoded open or closed brackets
@return the String with decoded double encoded open or closed brackets
437713
public static String doubleDecodeBrackets(final String input) {
		if (input == null || input.length() == 0) {  // For performance reasons don't use Util.empty
			return input;
		}
		return DOUBLE_DECODE_BRACKETS.translate(input);
	}
1177392
public static ByteBuffer decode(ByteBuffer input) throws IOException {
		byte[] out = new byte[input.remaining()];
		int pos = 0;
		int endingSpaces = 0;
		int endingSpacesSkipped = 0;
		while (input.hasRemaining()) {
			byte b = input.get();
			if ((b >= 33 && b <= 60) || (b >= 62 && b <= 126)) {
				out[pos++] = b;
				endingSpaces = 0;
				endingSpacesSkipped = 0;
				continue;
			}
			if (b == '=') {
				if (input.remaining() < 2) {
					// not enough data to read
					input.position(input.position() - 1);
					break;
				}
				char c1 = (char)(input.get() & 0xFF);
				char c2 = (char)(input.get() & 0xFF);
				if (c1 == '\r' && c2 == '\n') {
					// soft line break
					endingSpaces = 0;
					endingSpacesSkipped = 0;
					continue;
				}
				int i = StringUtil.decodeHexa(c1);
				if (i == -1) throw new IOException("Invalid hexadecimal value in quoted-printable");
				int j = StringUtil.decodeHexa(c2);
				if (j == -1) throw new IOException("Invalid hexadecimal value in quoted-printable");
				out[pos++] = (byte)((i << 4) | j);
				endingSpaces = 0;
				endingSpacesSkipped = 0;
				continue;
			}
			if (b == ' ' || b == '\t') {
				out[pos++] = b;
				endingSpaces++;
				continue;
			}
			if (b == '\r') {
				endingSpaces++;
				endingSpacesSkipped++;
				continue;
			}
			if (b == '\n') {
				// end of line
				pos -= endingSpaces - endingSpacesSkipped;
				endingSpaces = 0;
				endingSpacesSkipped = 0;
				continue;
			}
			throw new IOException("Unexpected byte " + b + " in quoted-printable data");
		}
		pos -= endingSpaces - endingSpacesSkipped;
		input.position(input.position() - endingSpaces);
		return ByteBuffer.wrap(out, 0, pos);
	}
222992
private static String escape(String input) {
        StringBuilder resultStr = new StringBuilder();
        for (char ch : input.toCharArray()) {
            if (isUnsafe(ch)) {
                resultStr.append('%');
                resultStr.append(toHex(ch / 16));
                resultStr.append(toHex(ch % 16));
            } else {
                resultStr.append(ch);
            }
        }
        return resultStr.toString();
    }
150661
public static String convertToRegexString(final String input) {
        return input.replaceAll("\\\\", "\\\\").replaceAll("\\*", "\\*").replaceAll("\\+", "\\+").replaceAll("\\]", "\\]").replaceAll("\\[",
                "\\[").replaceAll("\\(", "\\(").replaceAll("\\)", "\\)").replaceAll("\\?", "\\?").replaceAll("\\$", "\\$").replaceAll("\\|",
                "\\|").replaceAll("\\^", "\\^").replaceAll("\\.", "\\.");
    }
1162075
public static byte[] decodeChecked(String input) {
      byte tmp[] = decode(input);
      if (tmp == null || tmp.length < 4) {
         return null;
      }
      byte[] bytes = copyOfRange(tmp, 0, tmp.length - 4);
      byte[] checksum = copyOfRange(tmp, tmp.length - 4, tmp.length);

      tmp = HashUtils.doubleSha256(bytes);
      byte[] hash = copyOfRange(tmp, 0, 4);
      if (!Arrays.equals(checksum, hash)) {
         return null;
      }

      return bytes;
   }
1254051
protected List<Command> decodeInput(Codec codec, String input) {
        return codec.decode(input);
    }
171063
byte[] decodeLikeABoss(final byte[] input) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        if ((input.length & 0x01) == 0x01) {
            throw new IllegalArgumentException(
                "input.length(" + input.length + ") is not even");
        }

        final byte[] output = new byte[input.length / 2];

        int index = 0; // index in input
        for (int i = 0; i < output.length; i++) {
            final String s = new String(
                input, index, 2, StandardCharsets.US_ASCII);
            output[i] = (byte) Integer.parseInt(s, 16);
            index += 2;
        }

        return output;
    }
618337
public static String decodeString(final String string) {
		String decodedString = null;

		try {
			byte[] decodedBytes = decode(string);
			decodedString = new String(decodedBytes, "UTF-8");
		} catch (UnsupportedEncodingException uue) {
			// Should never happen, java has to support "UTF-8".
		}

		return decodedString;
	}
198153
public static String[] nullifyBadInput(String[] input)
    {
        if (input != null)
        {
            if (input.length > 0)
            {
                return input;
            }
        }
        return null;
    }
944147
public static String primArrayToString(Object input) {
		return new StructBehavior<String>(input) {

			@Override protected String booleanIf() { return Arrays.toString((boolean[]) this.delegate); }
			@Override protected String byteIf() { return Arrays.toString((byte[]) this.delegate); }
			@Override protected String characterIf() { return Arrays.toString((char[]) this.delegate); }
			@Override protected String doubleIf() { return Arrays.toString((double[]) this.delegate); }
			@Override protected String floatIf() { return Arrays.toString((float[]) this.delegate); }
			@Override protected String integerIf() { return Arrays.toString((int[]) this.delegate); }
			@Override protected String longIf() { return Arrays.toString((long[]) this.delegate); }
			@Override protected String shortIf() { return Arrays.toString((short[]) this.delegate); }
			@Override protected String nullIf() { return null; }
			@Override protected String noneMatched() { return null; }
			
		}.doDetect();
	}
229817
@SuppressWarnings("StatementWithEmptyBody")
    public static byte[] decode(final String input) {
        ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            while (decodeChunk(out, in)) {
                // do nothing
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }

        return out.toByteArray();
    }
438429
public static String escapeString(String input) {
        StringBuilder escaped = new StringBuilder(input.length() + 10);
        escaped.append('"');
        for (int i = 0; i < input.length(); i++) {
            if (input.charAt(i) == '"') {
                escaped.append("\"\"");
            } else {
                escaped.append(input.charAt(i));
            }
        }
        escaped.append('"');
        return escaped.toString();
    }
1203156
public static String encode(String input)
    {
        try
        {
            return URLEncoder.encode(input, "UTF-8");
        }
        catch (UnsupportedEncodingException e)
        {
            // This never happens.
            return input;
        }
    }
1139073
private void parseParameters(String input) {
        for (String param : input.split("&")) {
            String[] pair = param.split("=");

            String name = (pair.length > 0) ? pair[0] : null;
            String value = (pair.length > 1) ? pair[1] : null;

            if (name != null) {
                setParameter(name, value);
            }
        }
    }
787921
public static String readString(DataInput in) throws IOException {
        int length = WritableUtils.readVInt(in);
        byte[] bytes = new byte[length];
        in.readFully(bytes, 0, length);
        return decode(bytes);
    }
1318354
public static Double[] asDoubleArray(List<Double> input) {
		Double[] result = new Double[input.size()];

		for (int i = 0; i < result.length; i++) {
			result[i] = input.get(i);
		}

		return result;
	}
105833
protected static String toLowerCase(String input) {
        if(Character.isUpperCase(input.charAt(0)))
            return input.substring(0, 1).toLowerCase() + input.substring(1);
        return input;
    }