Location
  • San Luis Obispo,
  • California,
  • United States

Top Contributors

java array

We gave the following string:

int [] array = {12, 23, -22, 0, 43, 545, -4, -55, 43, 12, 0, -999, -87}.

There must be two rows, one for storage and the other positive elements for the negative elements of string array, and extracting the necessary logic that will perform the appropriate elements and placing them in the appropriate thread.

In other words, in the line array that is given is to be obtained all the positive elements and be placed in a separate row. Also, all the elements to be obtained and the negative to be placed in a separate row.

You also need to determine the number of duplicates in the string array.

Of course, it is necessary functionality written to be applicable to any number of integers. But MY teacher said that my code doesn't have a target row and He gave me an example: Target strings are two additional rows you will place isolated positive and negative values. For example, if you have a string:
int arr = {1,2,3,4, -1, -2, -3, -4}
then the target ranges will be:
int pos = {1,2,3,4}
int hc = {-1, -2, -3, -4}
This outputs needs

Starter array: 12 23 -22 0 43 545 -4 -55 43 12 0 -999 -87

Positive array: 12 23 0 43 545 43 12 0

Negative array: -22 -4 -55 -999 -87

Duplicate array :12 0 43

Thx!!!
Help me to solve pls
2017-04-07.png
Rank: Sage

Expert Comment

Kyle Santos2017-04-07 04:36 PMID: 1986245
Hi,

Welcome to the site!

I recommend asking a question in the Java topic because we are not all Java experts here and this is more of a welcome ground.

Message me if you would like some help navigating the website.

Regards,
0
Rank: Savant

Expert Comment

Ray Paseur2017-04-08 08:30 AMID: 1986313
If you want a PHP solution, just post this exact question in the PHP zone!
0
Rank: Sage

Expert Comment

Kyle Santos2017-04-08 11:50 AMID: 1986332
1