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 03:30
Write a computer program to calculate the three-phase fault current for a fault at f in figure 1.16, with the network normal, and with one line at a time removedproblems 1.1 write a computer program to calculate the three-phase fault current for a fault at f in figure 1.16, with the network normal, and with one line at a time removed 20 power system relaying from service. the positive-sequence impedance data are given in the accompanying table. use the commonly made assumption that all prefault resistance values are (1.0+j0.0) pu, and neglect all resistance values. calculate the contribution to the fault flowing through the cb b and the voltage at that bus. for each calculated case, consider the two possibilities: cb b2 closed or open. the latter is known as the stub-end fault í• figure 1.16 problem 1.1 system data for figure 1.16 from to positive sequence 0.0+j0.1 0.05j0.15 0.04 j0.2 0.01 jo.i 0.015 + j0.15 0.01 j0.19 0.01 +j0.19 0.03+j0.1 0.0+j0.08 6 6 6 from service. the positive-sequence impedance data are given in the accompanying table. use the commonly made assumption that all prefault resistance values are (1.0 + j 0.0) pu, and neglect all resistance values. calculate the contribution to the fault flowing through the cb b1, and the voltage at that bus. for each calculated case, consider the two possibilities: cb b2 closed or open. the latter is known as the “stub-end” fault.
Answers: 2
question
Computers and Technology, 22.06.2019 08:30
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
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
question
Mathematics, 07.10.2021 17:30
question
Computers and Technology, 07.10.2021 17:30
question
Computers and Technology, 07.10.2021 17:30
question
Social Studies, 07.10.2021 17:40