-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppButtonGuts
More file actions
40 lines (38 loc) · 905 Bytes
/
AppButtonGuts
File metadata and controls
40 lines (38 loc) · 905 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
35
36
37
38
39
40
Array getExpiring(int daysTillExpired){
for(item in fridge){
if(item.expiresInDays()<daysTillExpired){
//put in list
}
}
}
public int[] sortList(int[] array){
int k = 0;
while(k==0){
int size = array.length;
if(size == 1){
k = 1;
}
for(int i=0; i<size-1; i++){
int a = array[i];
int b = array[i+1];
if(a>b){
int temp = a;
array[i] = b;
array[i+1] = temp;
}
}
int dummyVar = 0;
for(int j=0; j<size-1; j++){
if(array[j]<=array[j+1]){
dummyVar++;
}
}
if(dummyVar == size-1){
k = 1;
}
}
return array;
}
Array getExpiringList(Int daysTillExpired){
return sortList(getExpiring(daysTillExpired));
}