S
Shawn
Hi,
I am translating a Fortran program to Java code. Starting FORTRAN 90, an
array size can be un-specified, for example:
DIMENSION PS(*)
is an array with size unspecified. On the run-time, its size can be
increased automatically if needed.
Previously, I use Object array in Java to translate FORTRAN array. But
now, array in Java have to be fixed size.
If I use collections in Java, like Vector or ArrayList, the problem is,
as stated in my posting previously and copied to below:
Vector vec = new Vector();
vec.add(0, new Integer(4));
vec.add(1, new Double(4.4));
vec.add(2, "How are you?");
vec.add(5, "morning");
The last one is one error and the program cannot run. I purposely
skipped a couple positions.
There is a reason that I need skipping: I am "translating" Fortran code
to Java. In the original Fortran code, it takes an array several item
positions to hold a long string, like "How are you?". In Java, it only
needs one item position to hold it. I hope to keep index in Fortran and
Java correspondent, so I need skipping to let several item positions
unused. But the program will not run now.
Maybe I need:
vec.add(3, null);
vec.add(4, null);
?
Thank you again for your help.
I am translating a Fortran program to Java code. Starting FORTRAN 90, an
array size can be un-specified, for example:
DIMENSION PS(*)
is an array with size unspecified. On the run-time, its size can be
increased automatically if needed.
Previously, I use Object array in Java to translate FORTRAN array. But
now, array in Java have to be fixed size.
If I use collections in Java, like Vector or ArrayList, the problem is,
as stated in my posting previously and copied to below:
Vector vec = new Vector();
vec.add(0, new Integer(4));
vec.add(1, new Double(4.4));
vec.add(2, "How are you?");
vec.add(5, "morning");
The last one is one error and the program cannot run. I purposely
skipped a couple positions.
There is a reason that I need skipping: I am "translating" Fortran code
to Java. In the original Fortran code, it takes an array several item
positions to hold a long string, like "How are you?". In Java, it only
needs one item position to hold it. I hope to keep index in Fortran and
Java correspondent, so I need skipping to let several item positions
unused. But the program will not run now.
Maybe I need:
vec.add(3, null);
vec.add(4, null);
?
Thank you again for your help.