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

javaʵÏֵĻôÄɹæÔòµÄ¶àÏîʽ¼ÆËã

»ôÄɹæÔò¶àÏîʽ¼ÆËãÈç¹ûʹÓÃÆÓËØµÄ¶àÏîʽÇóÖµ£¬Ê±¼ä¸´ÔÓ¶ÈΪO(n*n)£¬¶øÊÇÓÃÁË»ôÄɹæÔò¿ÉÒÔʹÓõݹé»òÕßµü´úÀ´ÊµÏÖ£¬Ê±¼ä¸´ÔÓ¶ÈÊÇO(n),ÏÂÃæÊÇÔ´´úÂë:
/*
* ʵÏÖ»ôÄɹæÔòµÄ¶àÏîʽ¼ÆËãʱ¼ä¸´ÔÓ¶ÈΪO(N)
*/
public class HuonaRule {
public static void main(String args[])
{
double data[]=new double[]{1.0,2,2,3,4};
double x=3;
System.out.println(huonaFunction(data,x,data.length));

}
/*
* dataΪ¶àÏîʽµÄϵÊýÊý×飬xΪֵ£¬nΪϵÊýÊý×éµÄ³¤¶È
* Y=a0+a1*X+a2*X^2+.....+an*X^n;
* Y=a0+X(a1+X(a2+X(a3+X(...))))
*/
public static double huonaFunction(double[] data,double x,int n)
{
double y=0;
int i=n-1;
while( i>=0 )
{
y=x*y+data[i];
i--;
}
return y;
}
}


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

Java SE ¶àÏß³Ì Ïß³ÌÉúÃüÖÜÆÚ

package thread;
class ThreadTest4 implements Runnable{
 private boolean flag=true;
 public void stopMe(){
  flag=false;
 }
 public void run() {
  while (flag){
   System.out.println(Thread.currentThread().getName()+" is running ");
&nbs ......

Java 7ÒѾ­Íê³ÉµÄÆß´óй¦ÄÜÔ¤ÀÀ

Java 7ÒѾ­Íê³ÉµÄ7´óй¦ÄÜ£º
1£©¶Ô¼¯ºÏÀàµÄÓïÑÔÖ§³Ö£»
2£©×Ô¶¯×ÊÔ´¹ÜÀí£»
3£©¸Ä½øµÄͨÓÃʵÀý´´½¨ÀàÐÍÍÆ¶Ï£»
4£©Êý×Ö×ÖÃæÁ¿Ï»®ÏßÖ§³Ö£»
5£©switchÖÐʹÓÃstring£»
6£©¶þ½øÖÆ×ÖÃæÁ¿£»
7£©¼ò»¯¿É±ä²ÎÊý·½·¨µ÷Óá£
ÏÂÃæÎÒÃÇÀ´×Ðϸ¿´Ò»ÏÂÕâ7´óй¦ÄÜ£º
¶Ô¼¯ºÏÀàµÄÓïÑÔÖ§³Ö
Java½«°üº¬¶Ô´´½¨¼¯ºÏÀàµÄµÚÒ»ÀàÓïÑÔÖ§³Ö¡ ......

javaʵÏÖµÄðÅÝÅÅÐò

ðÅÝÅÅÐòÊÇÒ»ÖÖºÜÁ÷Ðкܼòµ¥µÄÅÅÐòËã·¨£¬ËüÖØ¸´µÄ½»»»ÏàÁÚÁ½¸ö·´ÐòÔªËØ¡£
import java.util.Date;
import java.util.Random;
public class BubbleSort {
public static void main(String args[])
{
int len = 40;
Date date = new Date();
Random random = new Random(date.getSeconds());
int data[]=n ......

Java Reflection dzÎö2

inner classºÍouter classÖ®¼äµÄreflectionÓ¦Óá£
package com.gaoqian.reflection;
import java.lang.reflect.Field;  
import java.lang.reflect.Modifier;  
import java.lang.reflect.Constructor;  
import java.lang.reflect.Method;  
 
class IncludeInn ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ