Today, in the "Data Structure (Java)", I thought I didn't think that the array can be used when I first see the array; now give the code, because there is no book mentioned in the consoleReader, So I changed the code and use System.in to accept the user's input. ---------------------------------------- ARRAY01.JAVA CODE ---- --------------------------------------- / ** * Title: One-dimensional array Advanced Usage * INTENT: Through a one-dimensional array of INT, the basic data type INT is not enough * Cause: Due to the type of Java, the int range is -2, 147, 483, 648 to 2, 147, 483, 647, 32-bit * but when the calculation result is exceeded, The program returns out, so we use the array to make up for this. * EXPLAIN: 1-dimensional array DATA in size is generated first, and each time the size of DATA [i] is greater than 10.
* / import java.io. *; public class array01 {public static void main (string [] args) throws ioException {INPUTSTREAM IEXCEPTION = new int [40]; // Generate a single-dimensional array of size 40 Int Digit; // Data Bit INT I, J, R, K; // Cycle Router Variable INT N = 0; // User Enter Int Index; for (i = 1; I <40; I ) Data [i ] = 0; // Set the initial value of the array to 0 DATA [0] = 1; // Set the first bit of 1; DATA [1] = 1; // Set the second bit of 1; DITIT = 1 // set the data bit of 1 system.out.println ("Enter a Number"); in = system.in; // Read User Enter N = in.read () - 48; Index = In.available () WHILE (index> 2) {n = n * 10 (in.read () - 48); if (n> 35) {system.out.println ("sorry, the number is to lad"; system. Exit (1);} index -;} for (j = 1; j