Java high imitation Sina Weibo short link address generation tool ShortUrlGenerator. java, Sina Weibo QR code generation

Source: Internet
Author: User

Java high imitation Sina Weibo short link address generation tool ShortUrlGenerator. java, Sina Weibo QR code generation

Original article: Copy Sina Weibo short link address generation tool ShortUrlGenerator. java

Source code: http://www.zuidaima.com/share/1550463378934784.htm

Sina Weibo short link Generation Tool

ShortUrlGenerator. java

String sLongUrl = "http://www.zuidaima.com/share/1550463378934784.htm"; // 3BD768E58042156E54626860E241E999

String [] aResult = jsonurl (sLongUrl );

// Print the result

For (int I = 0; I <aResult. length; I ++ ){

System. out. println ("[" + I + "]:" + aResult [I]);

}

/// The console output is as follows: [0]: 7 nUFJn [1]: f6Zzy2 [2]: j6jmQb [3]: 2 eAjea

/** Copyright 2012-2013 The Haohui Network Corporation */package com. zuidaima. haohui. common. utils; /*** @ project baidamei * @ author cevencheng <cevencheng@gmail.com> www.zuidaima.com * @ create 2012-11-10 am 1:15:05 */public class ShortUrlGenerator {/*** @ param args */public static void main (String [] args) {// persistent connection: http://www.zuidaima.com/share/1550463378934784.htm// Sina resolved after the short link: http://t.cn/h1jGSCString sLongUrl = "http://www.zuidaima.com/share/1550463378934784.htm"; // 3BD768E58042156E54626860E241E999String [] aResult = Invalid URL (sLongUrl ); // print the result for (int I = 0; I <aResult. length; I ++) {System. out. println ("[" + I + "]:" + aResult [I]) ;}} public static String [] Invalid url (String url) {// you can customize the hybrid KEYString key = "wuguowei" before MD5 encrypted characters are passed in "; // use the String [] chars = new String [] {"a", "B", "c", "d", "e ", "f", "g", "h", "I", "j", "k", "l", "m", "n", "o ", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y ", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8 ", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I ", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S ", "T", "U", "V", "W", "X", "Y", "Z "}; // perform MD5 encryption on the input URL // String sMD5EncryptResult = (new CMyEncrypt ()). getMD5OfStr (key + url); String sMD5EncryptResult = MD5.md5Encode (key + url); String hex = sMD5EncryptResult; String [] resUrl = new String [4]; for (int I = 0; I <4; I ++) {// bitwise AND OPERATION String sTempSubString = hex according to a group of octal characters and 0x3FFFFFFF. substring (I * 8, I * 8 + 8); // you need to use the long type for conversion, because Inteper. parseInt () can only process 31 bits. The first part is the symbol bit. If you do not use // long, the long lHexLong = 0x3FFFFFFF & Long. parseLong (sTempSubString, 16); String outChars = ""; for (int j = 0; j <6; j ++) {// bitwise AND operation are performed on the obtained value and 0x0000003D to obtain the character array chars index long index = 0x0000003D & lHexLong; // Add the obtained characters outChars + = chars [(int) index]; // shift the right of each loop by bit by 5 lHexLong = lHexLong> 5 ;} // store the string to the output array resUrl [I] = outChars;} return resUrl;} of the corresponding index ;}}

 


Can I download the Sina Weibo client for a high-imitation iPhone 4? How can I download the iphone 20 platform, JAR format, and JAVA?

Find the mobile app on Sina. You can find the mobile app in it, or you can directly search for the app in JAR format in the mobile app version of Baidu Sina Weibo client.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.