Forums Register Login

how to modify the type of a data ?

+Pie Number of slices to send: Send
Hello,
I am trying to convert VBA code to Java and here is where I am stuck :

How, in Java, do I have to decalre my array of Double "data" in the method "produce" ?
How declare "data" in the method "read_file" to find it transformed then to pass it to the method "create" ?
How to change the type/do the "Redim" in the method "read_file" ?
Thanks for your help as I am returning to Java after more than 10 year stop...
+Pie Number of slices to send: Send
Hi,

Could you please describe in simple words the goal of the method?
Does it needs to return something, does it needs to take any inputs from outside?

That could look like pseudo code, which would be understandable by everyone. Thank you.

[edit] And welcome to the Ranch
+Pie Number of slices to send: Send
Welcome again

I presume you once knew how to declare variables; you can remind yourself in the Java™ Tutorials.
+Pie Number of slices to send: Send
Hello,
Thank you for your time. The vba code is actually already some pseudo code. In Java it would be something like :

I hope it is clearer.
Regards,
+Pie Number of slices to send: Send
Well, you're asking actually just a technical questions how it is done in Java. But keep in mind, that Java is quite different form VBA, and it won't let you do some crazy things as you could do with VBA.

jacques dusieur wrote:How, in Java, do I have to decalre my array of Double "data"


jacques dusieur wrote:How declare "data" in the method "read_file"


Honestly I don't feel it will help you much. Maybe it would help you better if you'd start reminding yourself about Java from here (<- link to click on).

As alternative, I think we could help you better if you'd describe what the method needs to do in details without using technical terminology, so we could adapt it to Java.
+Pie Number of slices to send: Send
Thank you. Unfortunately it is impossible to describe exactly what it does as it is a lot of statistics information treatment, but I have advanced a little in the skeleton comprehension. I know for sure that I will end up with a 2-dimensions array. I have now the following Java code :

I need to know how to define it correctly and how to pass it by reference (I would like to avoid returning my array, but instead have like an in/out parameter, which is called "pass a parameter by reference" I think) correctly because I still have these 2 issues :
At line PROBLEM 1, my array data seems to have only the first dimension initialised. Indeed, if toto is 100000 and titi 59,if I look up data[10][3] in debug mode, it says "<error(s)_during_the_evaluation>".
At line PROBLEM 2, my array data is null and has then lost the initialisation and the fill in done in readFile, I must be able to pass data by reference in order to retrieve it as it as been modified.
Thanks again in advance.
+Pie Number of slices to send: Send
 

jacques dusieur wrote:. . . how to pass it by reference . . .

There is no such thing as pass by reference in Java®. Don't initialise the array to null. Get the create method to return an array
double[][] myArray = readFile(myFile);
Why are you passing the array as an output parameter to two methods?
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 416 times.
Similar Threads
raw xml as the payload
Need some help, about synchronization topic
Convert VB.net to java
Uploading 4000 records in 1 minute
excel VBA question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:27:36.