Created
August 4, 2017 01:04
-
-
Save ramiresnas/4b52de9a8e99fa283e63837d9d4ef75b to your computer and use it in GitHub Desktop.
A question about array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class Question { | |
@SuppressWarnings({ "rawtypes", "unchecked" }) | |
public static void main(String[] args) { | |
int ind[] = { 1, 1, 2 ,2 ,2 ,3 ,3, 3, 3, 4, 4, 4}; | |
List x = new ArrayList(); | |
List y = new ArrayList(); | |
int k=4; | |
for(int i=0 ;i<ind.length;i++){ | |
if(ind[i] == k) | |
x.add(i); | |
else | |
y.add(i); | |
} | |
System.out.println(x); | |
System.out.println(y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment