關於我自己

我的相片
Welcome to discuss about : Chinese Traditional Medicine and Acupuncture Please send me the email: tccnchsu@gmail.com Chih-Yu Hsu

最新消息

總瀏覽量

2009年4月2日 星期四

第七週

第七週
上課錄影
http://www.powercam.cc/slide/1133

電腦軟體設計乙級技術士技能檢定術科 範例試題(Java)

google
關鍵字 usingarrays.java
www.cis.temple.edu/~ingargio/cis67/software/deitel-jHTP4/ch21/21_01/UsingArrays.java

關鍵字 sun java Arrays

yahoo
關鍵字sun java searchForInt
http://tw.search.yahoo.com/search?p=sun+java+searchForInt+&fr=yfp&rd=r1

http://www.cod.edu/People/Faculty/shamsudd/java/jLibClass-14.htm

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Arrays.html
範例試題 930201.s01

import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.StringTokenizer;


public class Perm {
static int[] array;
static String output = "";
public static void main(String[] args) {
File position;
File text;
String InFileName,OutFileName;

try{
InFileName = args[0];
StringTokenizer tokens = new StringTokenizer( InFileName, ".t");
position = new File(InFileName);
OutFileName = tokens.nextToken() + ".w" + tokens.nextToken();
System.out.print("Input File Name:" + InFileName + "\n" );
System.out.print("Output to the File :" + OutFileName);
text = new File(OutFileName);
}
catch(Exception e){
System.out.println("Error:"+e);
System.exit(1);
position = new File("");
text = new File("");
}


try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
array = new int[num+1];
for(int j=1; j<=num ; j++)
array[j]=j;
recursive(array, 1, num);
}

catch(IOException IOException){ }


try{

BufferedWriter output1 = new BufferedWriter(new FileWriter( text) );
output1.write(output);
output1.flush();

}
catch(IOException IOException){
}
System.exit(0);
}


public static void print(int[] a,int n, int k, int ii)
{
for (int i=1; i<=n; i++)
{
output+="The output is\n " +a[i];
}
output+="\n";
}
public static void recursive(int[] a, int k, int n)
{
int i, t;
for (i=1; i<=n; i++)
{
a[i] = a[i];
}
if(k==n)
{
for (i=1; i<=n; i++)
{
output+=" "+a[i];
}
output+="\n";
}
else
{
for(i=k; i<=n; i++)
{
t=a[i];
a[i]=a[k];
a[k]=t;
recursive(x, k, n);
}
}
}

}

12 則留言:

靖文 提到...
作者已經移除這則留言。
歐地 提到...

//第七週作業 D9539125 黃培熏
//UsingArrays.class
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
private int filledInt[], intValuesCopy[];

public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];
Arrays.fill( filledInt, 7 ); // fill with 7s
//Arrays.sort( doubleValues ); // sort doubleValues
System.arraycopy( intValues, 0, intValuesCopy, 0, intValues.length );
}

public void printArrays()
{
System.out.print( "doubleValues: " );
for ( int k = 0; k < doubleValues.length; k++ )
System.out.print( doubleValues[ k ] + " " );

System.out.print("\nintValues: " );
for ( int k = 0; k < intValues.length; k++ )
System.out.print( intValues[ k ] + " " );

System.out.print("\nfilledInt: " );
for ( int k = 0; k < filledInt.length; k++ )
System.out.print( filledInt[ k ] + " " );

System.out.print("\nintValuesCopy: " );
for ( int k = 0; k < intValuesCopy.length; k++ )
System.out.print( intValuesCopy[ k ] + " " );

System.out.println();
}

public int searchForInt( int value )
{ return Arrays.binarySearch( intValues, value ); }

public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" ) + " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );
System.out.println( "intValues " + ( b ? "==" : "!=" ) + " filledInt" );
}

public static void main( String args[] )
{
UsingArrays u = new UsingArrays();

u.printArrays();
u.printEquality();

int n = u.searchForInt( 5 );
System.out.println( ( n >= 0 ? "Found 5 at element " + n : "5 not found" ) + " in intValues" );
n = u.searchForInt( 8763 );
System.out.println( ( n >= 0 ? "Found 8763 at element "
+ n : "8763 not found" )
+ " in intValues" );
}
}

//HPS_007.class
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.util.StringTokenizer;

public class HPS_007 {
public static void main(String[] args)
{
UsingArrays use_array = new UsingArrays();
Arrays.sort(use_array.doubleValues);
for (int i=0;i<5;i++)
System.out.println(use_array.doubleValues[i]);
}
}

靖文 提到...

/*D9539108 陸靖文*/
import java.util.*;

class FB04 {

static int[] array;

public static void main(String[] args) {
int num = 4;
array = new int[num+1];
for(int j=0; j<=num ; j++) {
array[j]=j;

UsingArrays usingarrays = new UsingArrays();
Arrays.sort(usingarrays.doubleValues);
System.out.println(usingarrays.doubleValues[j]);

//System.out.println(array[j]);
}
}

}

//-------------------------------
// Fig. 21.1: UsingArrays.java
// Using Java arrays.

// Java core packages
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
public int filledInt[], intValuesCopy[];

// initialize arrays
public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];

Arrays.fill( filledInt, 7 ); // fill with 7s

//Arrays.sort( doubleValues ); // sort doubleValues

System.arraycopy( intValues, 0, intValuesCopy,
0, intValues.length );
}

// output values in each array
public void printArrays()
{
System.out.print( "doubleValues: " );

for ( int count = 0; count < doubleValues.length; count++ )
System.out.print( doubleValues[ count ] + " " );

System.out.print( "\nintValues: " );

for ( int count = 0; count < intValues.length; count++ )
System.out.print( intValues[ count ] + " " );

System.out.print( "\nfilledInt: " );

for ( int count = 0; count < filledInt.length; count++ )
System.out.print( filledInt[ count ] + " " );

System.out.print( "\nintValuesCopy: " );

for ( int count = 0; count < intValuesCopy.length; count++ )
System.out.print( intValuesCopy[ count ] + " " );

System.out.println();
}

// find value in array intValues
public int searchForInt( int value )
{
return Arrays.binarySearch( intValues, value );
}

// compare array contents
public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " filledInt" );
}

// execute application
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();

usingArrays.printArrays();
usingArrays.printEquality();

int location = usingArrays.searchForInt( 5 );
System.out.println( ( location >= 0 ?
"Found 5 at element " + location : "5 not found" ) +
" in intValues" );

location = usingArrays.searchForInt( 8763 );
System.out.println( ( location >= 0 ?
"Found 8763 at element " + location :
"8763 not found" ) + " in intValues" );
}

} // end class UsingArrays

/**************************************************************************
* (C) Copyright 2002 by Deitel & Associates, Inc. and Prentice Hall. *
* All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/

d9538905 提到...

D9538905

// Fig. 21.1: UsingArrays.java
// Using Java arrays.

// Java core packages
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
private int filledInt[], intValuesCopy[];

// initialize arrays
public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];

Arrays.fill( filledInt, 7 ); // fill with 7s

//Arrays.sort( doubleValues ); // sort doubleValues

System.arraycopy( intValues, 0, intValuesCopy,
0, intValues.length );
}

// output values in each array
public void printArrays()
{
System.out.print( "doubleValues: " );

for ( int count = 0; count < doubleValues.length; count++ )
System.out.print( doubleValues[ count ] + " " );

System.out.print( "\nintValues: " );

for ( int count = 0; count < intValues.length; count++ )
System.out.print( intValues[ count ] + " " );

System.out.print( "\nfilledInt: " );

for ( int count = 0; count < filledInt.length; count++ )
System.out.print( filledInt[ count ] + " " );

System.out.print( "\nintValuesCopy: " );

for ( int count = 0; count < intValuesCopy.length; count++ )
System.out.print( intValuesCopy[ count ] + " " );

System.out.println();
}

// find value in array intValues
public int searchForInt( int value )
{
return Arrays.binarySearch( intValues, value );
}

// compare array contents
public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " filledInt" );
}

// execute application
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();

usingArrays.printArrays();
usingArrays.printEquality();

int location = usingArrays.searchForInt( 5 );
System.out.println( ( location >= 0 ?
"Found 5 at element " + location : "5 not found" ) +
" in intValues" );

location = usingArrays.searchForInt( 8763 );
System.out.println( ( location >= 0 ?
"Found 8763 at element " + location :
"8763 not found" ) + " in intValues" );
}

} // end class UsingArrays

/**************************************************************************
* (C) Copyright 2002 by Deitel & Associates, Inc. and Prentice Hall. *
* All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/


import java.util.*;

class Mytest
{
static int[] array;

public static void main(String[] args)
{
int num = 15;
array = new int[num+1];
for(int j=1; j<=num ; j++)
{
array[j]=j;
//System.out.println(array[j]);
}
UsingArrays usingArrays=new UsingArrays();
//System.out.println(usingArrays.intValues[0]);
Arrays.sort( usingArrays.doubleValues );
for(int j=0; j<=4 ; j++){
System.out.println(usingArrays.doubleValues[j]);
}
}
}

dragon 提到...

/*第七週 d9582608 廖仁龍*/
import java.util.*;
class dark8
{
static int [] array;
public static void main(String []args)
{
int num = 5 ;
array = new int[num+1];
for (int j = 1; j <= num; j++)
{
array[j] = j;
System.out.println(array[j]);
}
UsingArrays usingArrays = new UsingArrays();
System.out.println(usingArrays.intValues[0]);
Arrays.sort(usingArrays.doubleValues);
System.out.println(usingArrays.doubleValues[0]);
System.out.println(usingArrays.doubleValues[1]);
System.out.println(usingArrays.doubleValues[2]);
System.out.println(usingArrays.doubleValues[3]);
System.out.println(usingArrays.doubleValues[4]);
}
}

radrops 提到...

第七週作業 D9582256 高岱群
// Fig. 21.1: UsingArrays.java
// Using Java arrays.

// Java core packages
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
private int filledInt[], intValuesCopy[];

// initialize arrays
public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];

Arrays.fill( filledInt, 7 ); // fill with 7s

//Arrays.sort( doubleValues ); // sort doubleValues

System.arraycopy( intValues, 0, intValuesCopy,
0, intValues.length );
}

// output values in each array
public void printArrays()
{
System.out.print( "doubleValues: " );

for ( int count = 0; count < doubleValues.length; count++ )
System.out.print( doubleValues[ count ] + " " );

System.out.print( "\nintValues: " );

for ( int count = 0; count < intValues.length; count++ )
System.out.print( intValues[ count ] + " " );

System.out.print( "\nfilledInt: " );

for ( int count = 0; count < filledInt.length; count++ )
System.out.print( filledInt[ count ] + " " );

System.out.print( "\nintValuesCopy: " );

for ( int count = 0; count < intValuesCopy.length; count++ )
System.out.print( intValuesCopy[ count ] + " " );

System.out.println();
}

// find value in array intValues
public int searchForInt( int value )
{
return Arrays.binarySearch( intValues, value );
}

// compare array contents
public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " filledInt" );
}

// execute application
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();

usingArrays.printArrays();
usingArrays.printEquality();

int location = usingArrays.searchForInt( 5 );
System.out.println( ( location >= 0 ?
"Found 5 at element " + location : "5 not found" ) +
" in intValues" );

location = usingArrays.searchForInt( 8763 );
System.out.println( ( location >= 0 ?
"Found 8763 at element " + location :
"8763 not found" ) + " in intValues" );
}

} // end class UsingArrays

-----------------------------------

import java.util.Arrays;
class Ratext
{
static int[] array;
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();
for(int j=0; j<=4 ; j++)
{
System.out.println(usingArrays.doubleValues[j]);
}
Arrays.sort(usingArrays.doubleValues);
for(int j=0; j<=4 ; j++)
{
System.out.println(usingArrays.doubleValues[j]);
}
}
}

提到...

//D9476995 應數四乙 辛為儒
import java.util.Arrays;

class Mytest
{
static int[] array;
public static void main( String args[] )
{
int num = 3;
int k = 0;
array = new int[num+1];
for (int j = 1; j <= num; j++)
{
array[j] = j;
//System.out.println(array[j]);
}
UsingArrays usingArrays = new UsingArrays();
System.out.println(usingArrays.intValues[0]);
Arrays.sort(usingArrays.doubleValues);

for (k = 0; k < 5; k++)
{

System.out.println(usingArrays.doubleValues[k]);

}

}
}

提到...

//第七週 d9476668陳秋宇

// Fig. 21.1: UsingArrays.java
// Using Java arrays.

// Java core packages
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
private int filledInt[], intValuesCopy[];

// initialize arrays
public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];

Arrays.fill( filledInt, 7 ); // fill with 7s

//Arrays.sort( doubleValues ); // sort doubleValues

System.arraycopy( intValues, 0, intValuesCopy,
0, intValues.length );
}

// output values in each array
public void printArrays()
{
System.out.print( "doubleValues: " );

for ( int count = 0; count < doubleValues.length; count++ )
System.out.print( doubleValues[ count ] + " " );

System.out.print( "\nintValues: " );

for ( int count = 0; count < intValues.length; count++ )
System.out.print( intValues[ count ] + " " );

System.out.print( "\nfilledInt: " );

for ( int count = 0; count < filledInt.length; count++ )
System.out.print( filledInt[ count ] + " " );

System.out.print( "\nintValuesCopy: " );

for ( int count = 0; count < intValuesCopy.length; count++ )
System.out.print( intValuesCopy[ count ] + " " );

System.out.println();
}

// find value in array intValues
public int searchForInt( int value )
{
return Arrays.binarySearch( intValues, value );
}

// compare array contents
public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " filledInt" );
}

// execute application
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();

usingArrays.printArrays();
usingArrays.printEquality();

int location = usingArrays.searchForInt( 5 );
System.out.println( ( location >= 0 ?
"Found 5 at element " + location : "5 not found" ) +
" in intValues" );

location = usingArrays.searchForInt( 8763 );
System.out.println( ( location >= 0 ?
"Found 8763 at element " + location :
"8763 not found" ) + " in intValues" );
}

} // end class UsingArrays

/**************************************************************************
* (C) Copyright 2002 by Deitel & Associates, Inc. and Prentice Hall. *
* All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
import java.util.Arrays;
class Mytestjava
{
static int[] array;
public static void main(String[] args)
{
int num=5;
array = new int[num+1];
for(int j=0; j<=num ; j++)
{
array[j]=j;
//System.out.println(array[j]);
}

UsingArrays usingArrays = new UsingArrays();
for(int j=0; j<=4 ; j++)
{
System.out.println(usingArrays.doubleValues[j]);
}


Arrays.sort(usingArrays.doubleValues);
for(int j=0; j<=4 ; j++)
{
System.out.println(usingArrays.doubleValues[j]);

}
}
}

提到...

D9377831 劉羽程
----------------------------------
import java.util.*;
class Mytest{

static int[] array;

public static void main(String[] args) {
int num = 4;
array = new int[num+1];

for(int j=0; j<=num ; j++) {
array[j]=j;
//System.out.println(array[j]);
UsingArrays usingarrays = new UsingArrays();
//System.out.println(usingarrays.intValues[0]);
Arrays.sort(usingarrays.doubleValues);
System.out.println(usingarrays.doubleValues[j]);

}
}
}
-----------------------------------

// Fig. 21.1: UsingArrays.java
// Using Java arrays.

// Java core packages
import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
public int filledInt[], intValuesCopy[];

// initialize arrays
public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];

Arrays.fill( filledInt, 7 ); // fill with 7s

//Arrays.sort( doubleValues ); // sort doubleValues

System.arraycopy( intValues, 0, intValuesCopy,
0, intValues.length );
}

// output values in each array
public void printArrays()
{
System.out.print( "doubleValues: " );

for ( int count = 0; count < doubleValues.length; count++ )
System.out.print( doubleValues[ count ] + " " );

System.out.print( "\nintValues: " );

for ( int count = 0; count < intValues.length; count++ )
System.out.print( intValues[ count ] + " " );

System.out.print( "\nfilledInt: " );

for ( int count = 0; count < filledInt.length; count++ )
System.out.print( filledInt[ count ] + " " );

System.out.print( "\nintValuesCopy: " );

for ( int count = 0; count < intValuesCopy.length; count++ )
System.out.print( intValuesCopy[ count ] + " " );

System.out.println();
}

// find value in array intValues
public int searchForInt( int value )
{
return Arrays.binarySearch( intValues, value );
}

// compare array contents
public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );

System.out.println( "intValues " + ( b ? "==" : "!=" )
+ " filledInt" );
}

// execute application
public static void main( String args[] )
{
UsingArrays usingArrays = new UsingArrays();

usingArrays.printArrays();
usingArrays.printEquality();

int location = usingArrays.searchForInt( 5 );
System.out.println( ( location >= 0 ?
"Found 5 at element " + location : "5 not found" ) +
" in intValues" );

location = usingArrays.searchForInt( 8763 );
System.out.println( ( location >= 0 ?
"Found 8763 at element " + location :
"8763 not found" ) + " in intValues" );
}

} // end class UsingArrays

/**************************************************************************
* (C) Copyright 2002 by Deitel & Associates, Inc. and Prentice Hall. *
* All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/

益銘梁 提到...

import java.util.*;

public class UsingArrays {
public int intValues[] = { 1, 2, 3, 4, 5, 6 };
public double doubleValues[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
private int filledInt[], intValuesCopy[];

public UsingArrays()
{
filledInt = new int[ 10 ];
intValuesCopy = new int[ intValues.length ];
Arrays.fill( filledInt, 7 ); // fill with 7s
// Arrays.sort( doubleValues ); // sort doubleValues
System.arraycopy( intValues, 0, intValuesCopy, 0, intValues.length );
}

public void printArrays()
{
System.out.print( "doubleValues: " );
for ( int k = 0; k < doubleValues.length; k++ )
System.out.print( doubleValues[ k ] + " " );

System.out.print("\nintValues: " );
for ( int k = 0; k < intValues.length; k++ )
System.out.print( intValues[ k ] + " " );

System.out.print("\nfilledInt: " );
for ( int k = 0; k < filledInt.length; k++ )
System.out.print( filledInt[ k ] + " " );

System.out.print("\nintValuesCopy: " );
for ( int k = 0; k < intValuesCopy.length; k++ )
System.out.print( intValuesCopy[ k ] + " " );

System.out.println();
}

public int searchForInt( int value )
{ return Arrays.binarySearch( intValues, value ); }

public void printEquality()
{
boolean b = Arrays.equals( intValues, intValuesCopy );

System.out.println( "intValues " + ( b ? "==" : "!=" ) + " intValuesCopy" );

b = Arrays.equals( intValues, filledInt );
System.out.println( "intValues " + ( b ? "==" : "!=" ) + " filledInt" );
}

public static void main( String args[] )
{
UsingArrays u = new UsingArrays();

u.printArrays();
u.printEquality();

int n = u.searchForInt( 5 );
System.out.println( ( n >= 0 ? "Found 5 at element " + n : "5 not found" ) + " in intValues" );
n = u.searchForInt( 8763 );
System.out.println( ( n >= 0 ? "Found 8763 at element "
+ n : "8763 not found" )
+ " in intValues" );
}
}


//2

import java.util.*;

class Mytest {

public static void main(String[] args)
{
UsingArrays usingArrays=new UsingArrays();
for(int i=0;i<5;i++)
System.out.println(usingArrays.doubleValues[i]);
System.out.println("...");
Arrays.sort(usingArrays.doubleValues);
for(int j=0;j<5;j++)
System.out.println(usingArrays.doubleValues[j]);

}
}

Wang 提到...

D9788173光電一王則元

import java.util.Arrays;

class Mytest
{
static int[] array;
public static void main (String [] args)
{
int num = 15;
//int i = usingarrays.doubleValues;
array = new int[num+1];
for(int j=0; j<=num ; j++)
{
array[j]=j;
//System.out.println(array[j]);
}


UsingArrays usingarrays =new UsingArrays();
//System.out.println(usingarrays.intValues[0]);

for(int i=0; i<=4 ; i++) {

System.out.println(usingarrays.doubleValues[i]);
}

for(int i=0; i<=4 ; i++) {
Arrays.sort( usingarrays.doubleValues );
System.out.println(usingarrays.doubleValues[i]);
}
}



}

DR.Hydra 提到...

//應數三甲 徐晟哲 D9538864
import java.util.*;
public class Mytest{

public static void main(String[] args) {
UsingArrays usingArrays=new UsingArrays();
for(int j=0; j<=4; j++)
System.out.println(usingArrays.doubleValues[j]);

System.out.println("----");
Arrays.sort(usingArrays.doubleValues);
for(int i=0; i<=4; i++)
System.out.println(usingArrays.doubleValues[i]);

}
}