This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 4530
    
    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: 4530
    
    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
 
 
subject: Need help in java array