Shrimp free download of shrimp music in Java

Here is the programming house jb51 CC collects and arranges code fragments through the network.

Programming house Xiaobian now shares it with you and gives you a reference.

static public String decodeRubust(String str) {
		if (str == null || str.length() < 1)
			return null;
		int num = Integer.valueOf(str.charAt(0) + "");
		int step = (str.length() - 1) / num;
		int helpStep = step;
		String[] matrix = new String[num];
		System.out.println(str.length() - 1);

		int duo = (str.length() - 1) % num;

		for (int i = 0,j = 1; i < matrix.length; i++,j = j + helpStep) {
			if (i < duo)
				helpStep = step + 1;
			else
				helpStep = step;

			matrix[i] = str.substring(j,j + helpStep);
			System.out.println(matrix[i]);
		}
		// print(matrix);

		return makeSense(matrix);

	}
private static String makeSense(String[] matrix) {
		StringBuffer sb = new StringBuffer();
		for (int j = 0; j < matrix[0].length(); j++) {
			for (int i = 0; i < matrix.length; i++) {
				if (matrix[i].length() - 1 >= j)
					sb.append(matrix[i].charAt(j));
			}
		}

		System.out.println(sb.toString());

		String tmp = new String();
		try {
			tmp = URLDecoder.decode(sb.toString(),"UTF-8");
			tmp = tmp.replaceAll("\\^","0");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			tmp = null;
		}

		if (tmp.subSequence(0,7).equals("http://") && tmp.substring(tmp.length()-6).equals("0-null"))
			return tmp;
		else
			return null;
	}

The above is all the code content collected by the programming home (jb51. CC). I hope this article can help you solve the program development problems you encounter.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>