Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!

# How is k=1:N expressed in JAVA

Elisabeth Ibeh
Greenhorn
Posts: 6
Hi,
How is k=1: (N+256)/2; expressed in Java.
k is the vector length.

Campbell Ritchie
Sheriff
Posts: 48984
60
Welcome to the Ranch

What does that formula mean?

Elisabeth Ibeh
Greenhorn
Posts: 6
Thanks.
It is the length of the frequency vector.

Campbell Ritchie
Sheriff
Posts: 48984
60
You have already told us that. How do you work it out? Does : mean divide?

Elisabeth Ibeh
Greenhorn
Posts: 6
means the the length starts from 1 to (N+256)/2
I am new to Java, usually work with Matlab.
any help will be appreciated. Thanks

Campbell Ritchie
Sheriff
Posts: 48984
60
Afraid I am not familiar with that algorithm.
Sounds like something for a loop. In which case you might have multiple results and they will have to go into an N‑length array.

Winston Gutkowski
Bartender
Posts: 10417
63
• 1
Elisabeth Ibeh wrote:means the the length starts from 1 to (N+256)/2

Yes, but I think what's being asked is: what is N? For the purposes of the loop is it a constant, or can it change while the loop is in progress?

Either way, assuming that the loop is working with a counter, it could easily be something like:however, 'k' could just as well be a float or a double if you need it to be.

You should also understand the difference between integer and floating-point division, because if n (and in Java, by convention, it's 'n', not 'N') is an integer type, it will behave differently from if it's a floating-point type.

Winston

Elisabeth Ibeh
Greenhorn
Posts: 6
Thanks.