Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6110473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:31:11+00:00 2026-05-23T14:31:11+00:00

e.g.: If the number is 234, I would like the result to be List<String>

  • 0

e.g.:

  • If the number is 234, I would like the result to be List<String> containing 2,3,4 (3 elements)
  • If the number is 8763, I would like the result to be List<String> containing 8,7,6,3 (4 elements)

Does commons-math already have such a function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:31:11+00:00Added an answer on May 23, 2026 at 2:31 pm
    1. Convert the number to a String (123 becomes "123"). Use Integer.toString.
    2. Convert the string to a char array ("123" becomes {'1', '2', '3'}). Use String.toCharArray.
    3. Construct a new, empty Vector<String> (or some other List type).
    4. Convert each char in the char array to a String and push it onto the Vector ({'1', '2', '3'} becomes a Vector with "1", "2" and "3"). Use a for loop, Character.toString and List.add.

    Edit: You can’t use the Vector constructor; have to do it manually.

    int num = 123;
    char[] chars = Integer.toString(num).toCharArray();
    List<String> parts = new Vector<String>();
    for (char c : chars)
    {
        parts.add(Character.toString(c));
    }
    

    There isn’t an easier way to do this because it really isn’t a very obvious or common thing to want to do. For one thing, why do you need a List of Strings? Can you just have a list of Characters? That would eliminate step 3. Secondly, does it have to be a List or can it just be an array? That would eliminate step 4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string of letters ' aaabbbcccdddeeefffggg ' that i would like to
If I have a double (234.004223), etc., I would like to round this to
I would like to extract some text between two points in a string, in
So I have an array of numbers that look something like 1,708,234 2,802,532 11,083,432
Say I have the number 234 edit (in days). How can I find how
number of bound variables does not match number of tokens … on line 54
A number of our users have just upgraded from IE6 to IE7. the upgreaded
I have a number of files stored under res/raw . E.g.: yeh_vidhi_mangal.txt om_jai_mahavir.txt tumse_laagi_lagan.txt
I have seen a number of questions and answers on how to reduce your
HI Is there a way i can add commas to a number like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.