-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort.java
More file actions
37 lines (23 loc) · 673 Bytes
/
Copy pathsort.java
File metadata and controls
37 lines (23 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Arrays;
public class jk {
public static void main(String[] args) {
int value = 5;
int arr [] = {1,3,3,4,10,6,5,1,9,10};
int ar2 []= new int[arr.length];
int ar3 []= new int[arr.length];
Arrays.sort(arr);
for(int i = 0; i<arr.length; i++) {
if(value>arr[i]) {
ar2[i] = arr[i];
}
}
for(int i = 0; i<ar2.length; i++) {
if (ar2[i] !=0) {
if (((value / ar2[i]) % 1) == 0) {
ar3[i] = ar2[i];
}
}
}
System.out.println(Arrays.toString(ar3));
}
}