Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java±à³Ì ÓÐ1ÒÚ¸ö¸¡µãÊý£¬ÇëÕÒ³öÆäÖжԴóµÄ10000¸ö

 ÓÐ1ÒÚ¸ö¸¡µãÊý£¬ÇëÕÒ³öÆäÖжԴóµÄ10000¸ö¡£Ìáʾ£º¼ÙÉèÿ¸ö¸¡µãÊýÕ¼4¸ö×Ö½Ú£¬1ÒÚ¸ö¸¡µãÊý¾ÍÒªÕ¾µ½Ï൱´óµÄ¿Õ¼ä£¬Òò´Ë²»ÄÜÒ»´Î½«È«²¿¶ÁÈëÄÚ´æ½øÐÐÅÅÐò¡£
/**
*
*/
package com.code;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import junit.framework.Assert;
import org.junit.Test;
/**
* @author Chi
*
*/
public class FloatSelector {
// @Test
public void testGenerateData(){
this.generate(100000000);
}
@Test
public void select(){
long start = System.currentTimeMillis();
final int SIZE = 10000;
Float[] selected = new Float[SIZE];
BufferedInputStream in = new BufferedInputStream(this.getClass().getResourceAsStream("data"));
//Set buffer to load array for one time.
final int BUFFER_SIZE = SIZE * 4;
final byte[] buffer = new byte[BUFFER_SIZE];
//1, Fill selected array
int pointer = 0;
int read = 0;
try {
read = in.read(buffer);
for(int i = 0; i < read / 4; i++ ){
selected[pointer ++] = Float.intBitsToFloat(bytes2int(buffer, i*4));
}
//2, sort the array
Arrays.sort(selected, Collections.reverseOrder());
while((read = in.read(buffer)) > 0){
for(int i = 0; i < read / 4; i++ ){
float newValue = Float.intBitsToFloat(bytes2int(buffer, i*4));
int j;
for(j = selected.length - 1; j >= 0 && newValue > selected[j]; j--);
if(j < selected.length - 1){
//move
for(int k = selected.length - 1; k > j + 1; k --){
selected[k] = selected[k - 1];
}


Ïà¹ØÎĵµ£º

Java CGLIB

Java Cglib
1.CGLIB°üµÄ½éÉÜ
     ´úÀíΪ¿ØÖÆÒª·ÃÎʵÄÄ¿±ê¶ÔÏóÌṩÁËÒ»ÖÖ;¾¶¡£µ±·ÃÎʶÔÏóʱ£¬ËüÒýÈëÁËÒ»¸ö¼ä½ÓµÄ²ã¡£JDK×Ô´Ó1.3°æ±¾¿ªÊ¼£¬¾ÍÒýÈëÁ˶¯Ì¬´úÀí£¬²¢ÇÒ¾­³£±»ÓÃÀ´¶¯Ì¬µØ´´½¨´úÀí¡£JDKµÄ¶¯Ì¬´úÀíÓÃÆðÀ´·Ç³£¼òµ¥£¬µ±ËüÓÐÒ»¸öÏÞÖÆ£¬¾ÍÊÇʹÓö¯Ì¬´úÀíµÄ¶ÔÏó±ØÐëʵÏÖÒ»¸ö»ò¶à¸ö½Ó¿Ú¡£Èç¹ûÏë´úÀ ......

¾ö²ßÊ÷C4.5Ëã·¨Java´úÂë

    - ¼ÓÈë²ËÄñѧϰÍø£¬»ñµÃÕä²Ø×ÊÔ´

Java´úÂë Êý¾ÝÍÚ¾òÖоö²ßÊ÷C4.5Ô¤²âË㷨ʵÏÖ(°ë³ÉÆ·£¬»¹ÒªÐ´¹æÔòºó¼ôÖ¦¼°¶Ô·ÇÀëÉ¢Êý¾ÝÐÅÏ¢ÔöÒæ¼ÆËã) Java´úÂë package org.struct.decisiontree;   import java.util.ArrayList;   import java.util.Arrays; ......

javaÊý¾ÝÀàÐÍ

java£º4Àà8ÖÖ»ù´¡Êý¾ÝÀàÐÍ£º
ÕûÐÍ£ºbyte  short  int  long
¸¡µãÐÍ: float  double
²¼¶ûÐÍ£ºboolean
×Ö·ûÐÍ£ºchar
³ýÁË4Àà8ÖÖ»ù´¡Êý¾ÝÀàÐÍ£¬ÆäËûµÄÊý¾ÝÀàÐͶ¼ÊÇÒýÓÃÀàÐÍÀýÈ綨ÒåµÄclass µÈµÈ£¬ÕâÒ»µãÒì³£ÖØÒª¡£·ñÔò»áµ¼ÖÂÔÚʹÓÃcontainerʱ³ö´í£¬Ã¿Ìí¼ÓÒ»¸ö¶ÔÏó½øÈëcontainer¶¼±ØÐëÊÇÒ»¸ö¶ÔÏó¶ø²» ......

JAVAµÄÈÝÆ÷ List,Map,Set

JAVAµÄÈÝÆ÷---List,Map,Set
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð© CollectionÔÊÐíÏà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ