Also at stackoverflow
Please if you are going to start a discussion in multiple places, post a link at each to all of the others. This will allow anyone participating in the discussion to know what else is being said. See, for instance, this post
on the topic.
Your program is reasonably challenging for someone starting out with programming, but not impossibly so and I only point that out so there is no misconception.
Right from the start you should adopt standard Java programming conventions. The idea is that these conventions (which enhance readability) become a habit and, hence, effortless. Classes begin with a capital letter, and variables and methods with a lowercase one. So B
The code you posted is missing a couple of closing braces.
But even once added it isn't exactly clear to me what the problem is. Does the code you posted compile? If not and there are compiler messages you can't understand, post them. Does it do what you expect? (and what is that?) If not, what *does* it do?
(As a network administrator you must be tediously aware of "it doesn't wrok!" substituting for a problem description. The same applies with programming.)
Break it down and tackle each part separately addressing specific problems as they arise.