An array is a collection of items of the same data type. The train simulator project employs a number of arrays to represent sets of information such as the gradient profile, the motor characteristics and the train system information. This information is stored in tables. Data tables do contain a number of columns and rows. Arrays too can contain columns and rows this is declared as a two dimensional array or a matrix. An array can be initialized (created) as shown below.
Allocating the array and then filling each entry
int  gradients = new int ;
gradients  = -100;
gradients  = 0;
gradients  = 100;
gradients  = 75;
gradients  = 500;
Note: int stands for integer in java, the gradient values are integer values.
This simply initialises an array of gradient values called gradients. The size of this array is 5 (the value in the  brackets). All arrays count starts from zero (0), and not one, so if the size is 5, we expect the count start at 0 and terminate at 4. No more data can be entered after the fifth array value gradients .
By increasing the size of the above array from 5 to some finite value, the capacity of the array increases and more data can be entered.
A two dimensional array consists of a rows and columns and this can be declared in the program as:
int  current = new int ; for 12 rows and 10 columns.
To access a particular element in the matrix, two subscripts in separate brackets are specified for example:
current  = 500; for calling the item in the row 3 and column 4, which initially was zero, and replacing it by the value 500.
So each time we want to look at the item at this position of the matrix, we call the matrix as: – current , in the Java program and this will return the value 500.
This is a vital stage of the project since this approach is applied mainly in the creation of databases to store all the data that is used. The following Examples 16 and 17 show the implementation of the gradient profile data using arrays.
An array of character strings
Implementing a one-dimensional array for Gradient profile and Speed limit title parameters. In this figure, item parameters  = Station name, parameters  = Station position (m), parameters  = Gradient and so forth, the last array value is parameters  which has the value End of Speed Limit (m). This array has no specified size and this means that it can expand to any size if we keep adding values to it.
An array of Objects (data)
The data displayed in this example has been adapted from Mike Smith’s program for the Advanced Railway Research Center, University of Sheffield, 27th October 1999.
A two dimensional array (data), in this case the value data  is null, since there is nothing within the double quotation marks (“ ”), the values data , data , data , data ,and data, are all 0’s , the value data = Camden Town and so on. In the Train simulator program, the above two codes are linked together to produce a table l shown in