Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
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.
 
Marshal
Posts: 69395
276
  • 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
Marshal
Posts: 69395
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And a String instead of a Chromosome is hardly better.
 
Bartender
Posts: 2230
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • 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:)
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic