4 Replies - 895 Views - Last Post: 04 March 2009 - 05:50 PM Rate Topic: -----

#1 mapa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-February 09

What does this Java code do ?

Posted 03 March 2009 - 12:19 PM

can some tell me please what this function does
	public Chromosome(String s) {
		this.macdSlowdays = Integer.parseInt(s.substring(0, 8), 2);
		this.macdFastdays = Integer.parseInt(s.substring(8, 16), 2);
		this.macdAverage = Integer.parseInt(s.substring(16, 24), 2);
		this.rsiDays = Integer.parseInt(s.substring(24, 32), 2);
		this.timeWindow = Integer.parseInt(s.substring(32, 40), 2);
		this.generation = Integer.parseInt(s.substring(40), 2);
	}




thanks.

This post has been edited by pbl: 04 March 2009 - 05:51 PM


Is This A Good Question/Topic? 0
  • +

Replies To: What does this Java code do ?

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 550
  • View blog
  • Posts: 5,624
  • Joined: 20-March 08

Re: What does this Java code do ?

Posted 03 March 2009 - 12:22 PM

It's setting values of the instance variables of a class called Chromosome based on some String that's given to the constructor.

Without the rest of the code to the Chromosome class, I can't help you much.
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: What does this Java code do ?

Posted 03 March 2009 - 05:31 PM

Please try to find a topic more descriptive than "Java code"
in a forum devoted to Java programmic it is kind of useless

Thank you
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: What does this Java code do ?

Posted 03 March 2009 - 10:52 PM

I can't help but wonder if this thread is related to this one.
Was This Post Helpful? 0
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: What does this Java code do ?

Posted 04 March 2009 - 05:50 PM

View Postborn2c0de, on 3 Mar, 2009 - 09:52 PM, said:

I can't help but wonder if this thread is related to this one.

I guess 2 students with the same assignment
I would have merged the topics if they had been posted by the same DIC
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1