Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java add values to array

// 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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #add #values #array
ADD COMMENT
Topic
Name
1+7 =