• Post Reply Bookmark Topic Watch Topic
  • New Topic

GA-Problem in type conversion of 1D String array into 2D int array  RSS feed

 
Gladis Thomas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an input of 1D String array, initially it contains 2 elements like,

0001111001001101011
1001110000101111011

Like this i will have 10 elements after the end of looping condition.

These 10 elements of String array need to be convert into 2D int array like,

chromosome_no chromosome

1 0001010000100001000

2 1110011101001100110

3 0010011001000011001

4 1101011110101100100

5 1001110000101101011

6 0000001101100100110

7 0001111001001111011

8 1100111010000110001

9 0110100101101100101

10 1101111010001010001

Finally the 2D array [chromosome_no][chromosomes] should store like that.

How can i resolve this problem?

Thanks in advance.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a Chromosome class? Changing a String to an int[] looks like a poor solution.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And a String instead of a Chromosome is hardly better.
 
Paweł Baczyński
Bartender
Posts: 1998
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:And a String instead of a Chromosome is hardly better.

Because Strings Are Bad.
 
Gladis Thomas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for your suggestions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!