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
Ïà¹ØÎĵµ£º
ºÜ¶àÅóÓÑÔÚÉîÈëµÄ½Ó´¥JavaÓïÑÔºó¾Í»á·¢ÏÖÕâÑùÁ½¸ö´Ê£º·´ÉäºÍÄÚÊ¡£¬Ö®Ç°ÎÒÃÇÒѾͨ¹ýʵÀý½âÎöÁËJavaµÄ·´Éä»úÖÆ£¬ÔÚʲô³¡ºÏÏÂÓ¦ÓÃÒÔ¼°ÈçºÎʹÓ㿽ñÌì°ÑÕâ¶þÕß·ÅÔÚÒ»Æð½éÉÜ£¬ÒòΪËüÃǶþÕßÊÇÏศÏà³ÉµÄ¡£
·´Éä
Ïà¶Ô¶øÑÔ£¬·´Éä±ÈÄÚÊ¡¸üÈÝÒ×Àí½âÒ»µã¡£ÓÃÒ»¾ä±È½Ï°×µÄ»°À´¸ÅÀ¨£¬·´Éä¾ÍÊÇÈÃÄã¿ÉÒÔͨ¹ýÃû³ÆÀ´µÃµ½¶ÔÏó(À࣬ÊôÐÔ£ ......
Java
Java£¬ÊÇÓÉSun Microsystems¹«Ë¾ÓÚ1995Äê5ÔÂÍƳöµÄJava³ÌÐòÉè¼ÆÓïÑÔºÍJavaƽ̨µÄ×ܳơ£ÓÃJavaʵÏÖµÄHotJavaä¯ÀÀÆ÷£¨Ö§³ÖJava applet£©ÏÔʾÁËJavaµÄ÷ÈÁ¦£º¿çƽ̨¡¢¶¯Ì¬µÄWeb¡¢Internet¼ÆËã¡£´Ó´Ë£¬Java±»¹ã·º½ÓÊܲ¢Íƶ¯ÁËWebµÄѸËÙ·¢Õ¹£¬³£ÓõÄä¯ÀÀÆ÷ÏÖÔÚ¾ùÖ§³ÖJava applet¡£
¡¡¡¡Javaƽ̨ÓÉJavaÐéÄâ»ú£¨Java Virt ......
java ¼¯ºÏ¿ò¼Ü(Collection)ºÍÊý×éµÄÅÅÐò
¸ù¾ÝÔ¼¶¨£¬ÔÚʹÓÃjava±à³ÌµÄʱºòÓ¦¾¡¿ÉÄܵÄʹÓÃÏÖÓеÄÀà¿â£¬µ±È»ÄãÒ²¿ÉÒÔ×Ô¼º±àдһ¸öÅÅÐòµÄ·½·¨£¬»òÕß¿ò¼Ü£¬µ«ÊÇÓм¸¸öÈËÄÜдµÃ±ÈJDKÀïµÄ»¹ÒªºÃÄØ£¿Ê¹ÓÃÏÖÓеÄÀàµÄÁíÒ»¸öºÃ´¦ÊÇ´úÂëÒ×ÓÚÔĶÁºÍά»¤£¬ÕâƪÎÄÕÂÖ÷Òª½²µÄÊÇÈçºÎʹÓÃÏÖÓеÄÀà¿â¶ÔÊý×éºÍ¸÷ÖÖCollectionÈÝÆ÷½ø ......
import java.io.*;
public class IoTest
{
public static void main(String[] args)
{
String s;
s=calculate();
System.out.println(s);
}
static String calculate()
{
StringBuffer sb=new StringBuffer("");
try{
FileReader re ......