013-003-007

Standard Library: Array Operations (Arrays)

Medium

Problem Description

Standard Library: Array Operations (Arrays)

Learning Objective: Learn to sort and search arrays efficiently using Java's Arrays class

Overview

Use static methods of the Arrays class to sort an integer array and search for elements. Use Arrays.sort() and Arrays.binarySearch().

Specifications

  • Sort integer array {5, 2, 8, 1, 9}
  • Output sorted array
  • Search for value 8 in sorted array using binary search and output index

Output Format

Sorted: [1, 2, 5, 8, 9]
Index of 8: 3

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?