// imports
import java.util.ArrayList;
import java.util.List;
// Creating a new ArrayList
List<Integer> myIntArray = new ArrayList<Integer>();
// Adding the element '3' to the array
myIntArray.add(3);
List<String> where = new ArrayList<String>();
where.add( ContactsContract.Contacts.HAS_PHONE_NUMBER+"=1" );
where.add( ContactsContract.Contacts.IN_VISIBLE_GROUP+"=1" );
// If you read array of unknown length, from console
// and you want to put numbers into array of fixed length
long[] array = Arrays.stream(scanner.nextLine().split(" "))
.mapToLong(Long::parseLong)
.toArray();
int[] array = Arrays.stream(scanner.nextLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
String[] simpleArray = new String[ where.size() ];
where.toArray( simpleArray );
// iterate over the array
for( String oneItem : where ) {
...
}
// get specific items
where.get( 1 );