wood burning stoves 2.0*
The moose likes Java in General and the fly likes Need help in java array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need help in java array" Watch "Need help in java array" New topic
Author

Need help in java array

berender mavi
Ranch Hand

Joined: Feb 18, 2011
Posts: 31
hi all

i want to convert array contents into literals.

suppose i have an array[]={515,234,123}

i want to convert it into '515','234','123'


array length is dynamic contents may be more or less.But i want them to be enclosed in ' ' and separated by ,
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

Loop over the array and build a string (using StringBuilder) with the characters you need.


luck, db
There are no new questions, but there may be new answers.
berender mavi
Ranch Hand

Joined: Feb 18, 2011
Posts: 31
can i use that converted string into "MYSQL IN QUERY"
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

Why would you want to? Use a PreparedStatement.
berender mavi
Ranch Hand

Joined: Feb 18, 2011
Posts: 31
but how i will fetch data from table on the basis of contents of java array
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help in java array