For the int and double arrays, you'd use 0, not null.
Using multiple arrays like this in parallel is almost always a bad idea. It's hard to work with, hard to get right. Why now create a small class named "Element", which has name, atomicNumber, and atomicWeight properties, and then have one single array (or better, a java.util.ArrayList) full of Elements? This keeps the related values together in one object.
No, it isn't a nightmare. It is really quite simple. There are 114 elements, so set up a 115-member array. You can then fit them all in missing out 0 and 113; these will remain null. Remember that arrays start with index 0 and all their members default to null for objects or 0 for primitive numbers or false for boolean primitives. That way you can avoid having elements = helium, elements = beryllium.
Then, as Ernest Friedmann-Hill has told you (I would have told you, only the Ranch website went down and lost my post earlier today), create an Element class with (probably final) fields for atomic number, name, symbol ("H", "He" etc) and atomic mass. Then you can put them into the array in order. You will unfortunately have to write out or copy-and-paste all the names and numbers you write earlier.
Tell us how you get on.
posted 12 years ago
But Bill Shirley's idea about writing all the data into a resource file and reading them into your application is a very good idea.
I'm sure glad that he's gone. Now I can read this tiny ad in peace!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop