a) Write an algorithm (implemented in Java) that provides queue functionality using a stack data structure and stack operations. You should provide operations to enqueue new elements, dequeue elements, peek at the value of the 'next' element for dequeuing, and test if the queue is empty.
b) Demonstrate its operation using a small dataset (such as {3, 8, 6, 2}) of mask sizes (child and adult only).