subject

Write a method that returns a version of the given array where all the 10's have been removed. The remaining elements should shift left towards the start of the array as needed, and the empty spaces at the end of the array should be set to 0. Ex: {1, 10, 10, 2} yields {1, 2, 0, 0}. You may modify and return the given array or make a new array.

Code:

public class RemoveTen {
public static void main(String[] args) {
int[] nums = {1, 10, 10, 2};
int[] result = removeTen(nums);
for(int i = 0; i < result. length; i++)
System. out. print(result[i] + " ");
}

public static int[] removeTen(int[] nums) {
/*FIXME Complete the implementation of the removeTen method*/
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
The most accurate readings that you can take on an analog vom are when the meter's pointer is at the a. center scale. b. extreme right. c. near right. d. extreme left.
Answers: 1
You know the right answer?
Write a method that returns a version of the given array where all the 10's have been removed. The r...
Questions
Questions on the website: 13722360