Welcome to the Forum! Please read this topic
to learn how to post code correctly and other useful tips for newcomers.
I know what i want to do but not how to write in code.
Then start by defining your design (the part you know you want to do) in comments or pseudo-code. It's not clear why you do not know how to write the code needed, but once you've documented your design in pseudo-code or comments, you can fill in the Java code you know how to do and work to learn the parts you don't know how to do. We'll help where we can when you ask specific questions related to code you've tried to write.