java£ºÈýÖÖ¾µä´óÅÅÐò»ã×Ü£¬Ã°ÅÝ£¬²åÈ룬ѡÔñ
package arrays.myArray;
public class SortArr {
public static void main(String[] args) {
int[] arrInt = { 4, 7, 8, 5, 6, 3, 2, 3, 4 };
maoPaoSort(arrInt);
print("ðÅÝÅÅÐò£º", arrInt);
arrInt = new int[]{ 4, 7, 8, 5, 6, 3, 2, 3, 4 };
insertSort(arrInt);
print("²åÈëÅÅÐò£º", arrInt);
arrInt = new int[]{ 4, 7, 8, 5, 6, 3, 2, 3, 4 };
checkSort(arrInt);
print("Ñ¡ÔñÅÅÐò£º", arrInt);
}
// ðÅÝÅÅÐò
private static void maoPaoSort(int[] arrInt) {
int temp = 0;
for (int i = 0; i < arrInt.length; i++) {
for (int j = 0; j < arrInt.length - 1; j++) {
if (arrInt[i] < arrInt[j]) {
temp = arrInt[i];
arrInt[i] = arrInt[j];
arrInt[j] = temp;
}
}
}
}
// ²åÈëÅÅÐò
private static void insertSort(int[] arrInt) {
//µ¹ÊýµÚ¶þ¸ö¿ªÊ¼±È½Ï
for (int i = arrInt.length - 2; i >= 0; i--) {
int j = 0;
for (j = arrInt.length - 1; j > i; j--) {
if (arrInt[i] > arrInt[j]) {
break;
}
}
int temp = arrInt[i];
for (int k = i; k < j; k++) {
arrInt[k] = arrInt[k + 1];
}
arrInt[j] = temp;
}
//ÕýÊýµÚ¶þ¸ö¿ªÊ¼±È½Ï
/*for (int i = 1; i < arrInt.length; i++) {
int j = 0;
for (j = 0; j < arrInt.length - 1; j++) {
if (arrInt[i] > arrInt[j]) {
break;
}
}
&nbs
Ïà¹ØÎĵµ£º
1. javaÓëÆ½Ì¨Î޹ء£Ô´´úÂëÓɱàÒëÆ÷±àÒëΪ×Ö½ÚÂ루JVM¿ÉÖ´ÐдúÂ룩£»½âÊÍÆ÷ÔËÐÐJVM×Ö½ÚÂ루·ÒëΪ»úÆ÷Â룩¼´¿ÉµÃµ½Êä³ö½á¹û¡£
×Ö½ÚÂë¿ÉÔÚ¶à¸öƽ̨ÔËÐУ¬²»ÐèÒªÖØÐ±àÒë¡£
c±àÒëÆ÷ÔÚ±àÒëʱÉú³ÉµÄ´úÂëÊÇÕë¶ÔÌØ¶¨µÄÓ²¼þƽ̨²úÉúµÄ¡£
2. java¿ª·¢¹¤¾ßJDK¡£°²×°JDKʱ×Ô´øjre£¬¾ÍÊÇjavaÐéÄâ»ú¡£
jdkÊÇJava¿ª·¢¹¤¾ß°ü£¬°üº¬Á˸ ......
package com.njty.util;
public class Test {
private static final double EARTH_RADIUS = 6378137;
private static double rad(double d)
{
return d * Math.PI / 180.0;
}
  ......
Öйú¹«ÀúËã·¨²»ÊÇÌ«ÄÑ£¬¹Ø¼üÊÇÐÇÆÚÖµµÄÈ·¶¨¡£ÕâÀï¸ø³öÁ˼òµ¥Ëã·¨£º
public static int dayOfWeek(int y, int m, int d) {
int w = 1; // ¹«ÀúÒ»ÄêÒ»ÔÂÒ»ÈÕÊÇÐÇÆÚÒ»£¬ËùÒÔÆðʼֵΪÐÇÆÚÈÕ
y = (y-1)%400 + 1; //&n ......
package arrays.compara;
import java.util.Arrays;
public class Student {
public static void main(String[] args) {
Stu[] stus = new Stu[]{
new Stu(156,34,"ad"),
new Stu(153,24,"cc"),
new Stu(126,37,"ab"),
......
package arrays.file;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
i ......