Java¾«µäÃæÊÔÌâÍÆ¼öÒ»(´ó¼Ò¿ÉÒÔ°Ñ×Ô¼ºµÄ´ð°¸¸½ÉÏ)
µÚÒ»´Î·¢,Ñ¡¸öÄѶÈÊʵ±ÖеÄ:ÎÒ¸Õ±Ïҵʱ²Î¼ÓµÄÒ»´Î±ÊÊÔ.
Ìâ:¶ÔÈÎÒâÊäÈëÈëµÄÒ»¸ö×Ö·û´®£¬°ÑÊý×Ö´ÓСµ½´óÅÅÁУ¬×ÖďĿÐòÅÅÁÐ,²¢ÇÒÊäÈëºó×ÖĸÓëÊý¾Ý½»ÌæÅÅÁС£
Èç:"5s3fa72cs4z134556sdd"Ö´ÐкóΪ"z1s2s3s3f4d4d5c5a56".
´ó¼Ò¿ÉÒÔÊÔÒ»ÏÂ,¹²Í¬Ñ§Ï°Âð?ÏÂÃæÊÇÎÒµ±³¡×öµÄ,Ïëµ½ÄÄдµ½ÄÄ,Ëã·¨¿Ï¶¨²»ÓÅ,½ö¹©²Î¿¼.
import java.util.Arrays;
public class DifficultTest {
/*
* ¶ÔÈÎÒâÊäÈëÈëµÄÒ»¸ö×Ö·û´®£¬°ÑÊý×Ö´ÓСµ½´óÅÅÁУ¬×ÖďĿÐòÅÅÁÐ,²¢ÇÒÊäÈëºó×ÖĸÓëÊý¾Ý½»ÌæÅÅÁС£
*/
public String aMethod(String str) {
String number = "";
String str1 = "";
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
number = number + str.charAt(i) + "";
} else {
str1 = str1 + str.charAt(i);
}
}
int[] number1 = new int[number.length()];
char[] str2 = new char[str1.length()];
for (int i = 0; i < number.length(); i++) {
number1[i] = Integer.parseInt(number.charAt(i) + "");
}
Arrays.sort(number1);
for (int i = 0; i < str1.length(); i++) {
str2[i] = str1.charAt(i);
}
Arrays.sort(str2);
String[] resStr = new String[str2.length];
for (int i = 0; i < str2.length; i++) {
resStr[i] = str2[str2.length - 1 - i] + "";
}
String total = "";
for (int i = 0; i < str.length(); i++) {
if (i % 2 == 0 && i / 2 < resStr.length) {
total = total + resStr[i / 2];
} else if (i % 2 == 1 && i / 2 < number1.length) {
total = total + number1[i / 2];
}
}
return total;
}
public static void main(String[] args) {
&nb
Ïà¹ØÎĵµ£º
1. ¸ÅÊö
±¾ÎÄÖ÷Òª°üÀ¨ÒÔϼ¸¸ö·½Ã棺±àÂë»ù±¾ÖªÊ¶£¬java£¬ÏµÍ³Èí¼þ£¬url£¬¹¤¾ßÈí¼þµÈ¡£
ÔÚÏÂÃæµÄÃèÊöÖУ¬½«ÒÔ"ÖÐÎÄ"Á½¸ö×ÖΪÀý£¬¾²é±í¿ÉÒÔÖªµÀÆäGB2312±àÂëÊÇ"d6d0 cec4"£¬Unicode±àÂëΪ"4e2d 6587"£¬UTF±àÂë¾ÍÊÇ"e4b8ad e69687"¡£×¢Ò⣬ÕâÁ½¸ö×ÖûÓÐiso8859-1±àÂ룬µ«¿ÉÒÔÓÃiso8859-1±àÂëÀ´"±íʾ"¡£  ......
£¨1£©Ìí¼Ó±àÒëjava²Ëµ¥
1¡¢´ò¿ª ¸ß¼¶£>¹¤¾ßÅäÖÃ
2¡¢ÔÚ“ÃüÁîÀ¸”ÀïÊäÈë javac %n%e £¨%nΪÎļþÃû²»´øÀ©Õ¹Ãû£¬%eΪÀ©Õ¹Ãû£©
3¡¢ÔÚ“¹¤×÷Ŀ¼”ÉÏÌî %p (±íʾÎļþËùÔÚĿ¼)
4¡¢ÔÚ“²Ëµ¥ÏîÄ¿Ãû³Æ”ÉÏÊäÈë ±àÒëjava³ÌÐò £¨ÏÖÔÚÔڲ˵¥ÉϵÄÃû³Æ£©
5¡¢Ñ¡Ôñ“±£´æµ±Ç°Îļþ”¸´Ñ¡¿ ......
ÊʺϳõѧÕßÀí½â
1£¬testflex.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
minWidth="955 ......
½ñÌìÎÒÔÚ×ö·É»ú¡£ÎªÊ²Ã´ËµÎÒÔÚ×ö·É»úÄØ£¡ÒòΪÕâÊÇÎÒ½ø´«ÖDz¥¿ÍÒÔÀ´£¬¸öÈ˸оõ·Ç³£ÖØÒªµÄÒ»ÌÿΣ¬µ«ÊÇÎÒ²»ÄÜÒ»ÏÂ×Ó¼ÇסËùËùÓеĶ«Î÷£¬×òÌìÍíÉÏ£¬¿´ÊÓÆµ¿´µ½ÍíÉÏÈýµã£¬½ñÌìÉϿκÜÏ뼯ÖÐ×¢ÒâÁ¦£¬µ«ÊÇ×îÖÕ»¹ÊÇÈ̲»×¡´òÁËî§Ë¯£¬µ«½ñÌìµÄµÄ¿Î¸øÎҵĸоõÊǷdz£¾ßÓÐÁ¬¹áÐÔ£¬Ç°ÃæµÄ¿ÎÈç¹ûÌýµÃ²»ÊǺÜÇ ......
·if ((ICO2 = getInitParameter("ICO2")) == null)
ICO2 = "images/commend.gif";
·ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST); ......