How to print k elements from the heap in increasing order?

I am constructing heap like this class Heap {
ArrayList data = new ArrayList<>();

void upHeapify(int ci, HashMap<Integer, Integer> mp) {
	int pi = (ci - 1) / 2;
	int freqPi = mp.get(data.get(pi));
	int freqCi = mp.get(data.get(ci));

	if (freqPi == freqCi) {
		if (data.get(ci) < data.get(pi)) {
			swap(ci, pi);
			upHeapify(pi);
		}
	} else {
		if (freqCi > freqPi ) {
			swap(ci, pi);
			upHeapify(pi);
		}
	}

} 


void insert(int d, HashMap<Integer, Integer> mp) {
	if (!mp.containsKey(d)) {
		mp.put(data, 1);
	} else {
		mp.put(data, mp.get(d) + 1);
	}

	upHeapify(data.size() - 1, mp);

}

void downHeapify(int pi, HashMap<Integer, Integer> mp) {
	int li = 2*pi + 1;
	int ri = 2*pi + 2;
	int mini = pi;
	
	if(li < data.size() -1) {
		if(mp.get(li) == mp.get(mini)) {
			if (data.get(li) < data.get(mini)) {
				mini = li;
			}
		} else {
			if (mp.get(li) > mp.get(mini)) {
				mini = li;
			}
		}
	}
	
	if(ri < data.size() -1) {
		if(mp.get(ri) == mp.get(mini)) {
			if (data.get(ri) < data.get(mini)) {
				mini = ri;
			}
		} else {
			if (mp.get(ri) > mp.get(mini)) {
				mini = ri;
			}
		}
	}
	
	if (mini != pi) {
		swap(mini, pi);
		downHeapify(mini, mp);
	}
	
	
}
void delete(HashMap<Integer, Integer> mp) {
	if (mp.containsKey(d)) {
		insert(d, mp);
		return;
	}
	
	swap(0, data.size() - 1);
	data.remove(data.size() - 1);
	downHeapify(0, mp);
}

int get() {
	return this.data.get(0);
}

}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.