⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intlist.java

📁 算法集合,说明java 中的各种算法的应用,带有源代码,可运行调试
💻 JAVA
字号:
// IntList class//    Main purpose of this class is to assemble lists of integers for//    testing//import java.awt.*;import java.io.*;import java.net.*;import java.util.*;public class IntList {	private int nodes_array[];	DataInputStream inStream;	private int num = 0;		public IntList( URL url ) {		try {			URLConnection urlc = url.openConnection();			inStream = new DataInputStream( urlc.getInputStream() );			num = loadNodes(inStream);			}		catch( IOException e ) {			System.out.println("IntList: URL connection error");			}		}		private int loadNodes(DataInputStream inStream) {		int n_nodes = 0, cnt = 0;		String line, item1;				System.out.println("Load_Nodes: entry" );		try {			if ((line = inStream.readLine()) != null) {				System.out.println("Load_Nodes: line [" + line + "]" );				StringTokenizer Data = new StringTokenizer(line, " ");				item1 = Data.nextToken();				n_nodes = Integer.parseInt( item1 );				System.out.println("instream is "+ n_nodes);		 				nodes_array = new int[n_nodes];						while(( cnt < n_nodes ) && ((line = inStream.readLine()) != null) ) {					System.out.println("Load_Nodes: line [" + line + "]" );					Data = new StringTokenizer(line, " ");					item1 = Data.nextToken();					nodes_array[cnt] = Integer.parseInt(item1);					cnt++;						}								}			}			catch (IOException e) {			System.err.println("error in file" +e.toString());			System.exit(1);			}		return n_nodes;			}	public int elementAt( int k ) {		if ( k < nodes_array.length ) {			return nodes_array[k];			}		else return -99;		}	public int size() {		return num;		}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -