You are on page 1of 11

TARLAC STATE UNIVERSITY

COMPUTER
COLLEGE OF COMPUTER STUDIES

PROGRAMMING 2 [Array
Processing/Classes]
ARRAY CLASS
 Provides static methods to dynamically create and access Java arrays.
 Consists of only static methods and the methods of Object class
 Methods of this class can be used by the class name itself.
binarySearch(type [] a, type key)
Searches the specified array for the specified key value using the binary search algorithm.
equals(type[] a, type[] a2)
Returns true if the two specified arrays of the same type are equal to one another
toString(type[] a)
Arrays.toString() method: Arrays.toString() method is used to return a string representation of
the contents of the specified array.
Convertion: String – Integer
Array
For this example, Integer.parseInt will be introduced. We will loop thru the Array Indices and
Convert String Elements into Integer Elements
.split(“char”)
Splitting String/Character Values based on the parameter given into the .split function then
storing the values into an Array.
Boolean Array
The boolean array can be used to store boolean datatype values only and the default value of
the boolean array is false. An array of booleans are initialized to false and arrays of reference
types are initialized to null. In some cases, we need to initialize all values of the boolean array
with true or false.
fill(type[] a, type val)
Assigns the specified value to each element of the specified array.
sort(type[] a)
Sorts the specified array into ascending order
Do you have any questions?

THANK rjdagustin@tsu.edu.ph
Tarlac State University
College of Computer Studies

S
CREDITS: This presentation template was created by Slidesgo, including
icons by Flaticon, and infographics & images by Freepik
Please keep this slide for attribution

You might also like