• 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 65111
247
  • 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: 65111
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And a String instead of a Chromosome is hardly better.
 
Bartender
Posts: 2219
47
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:)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!