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 9269447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:07:26+00:00 2026-06-18T15:07:26+00:00

I am exceptionally new to programming, but I am working on improving my skills

  • 0

I am exceptionally new to programming, but I am working on improving my skills as a programmer. Currently, I am working on a problem I gave myself where I am trying to take a variable number and make each of its digits a separate number in an array. I don’t care about the order of the digits, so if they are reversed, then it doesn’t matter to me. I know people have asked this question numerous times, but they always seem to use a lot of things that I don’t understand. Since my school doesn’t offer any Java courses, I only know what I have learned on my own, so if you could explain any terms you use in the code that aren’t extremely trivial, that would be wonderful. Right now, I have written:

int number = 1234567890;
    while (number > 0) {
        System.out.println(number%10);
        number = number/10; 

This works fine for printing the digits individually, but I can’t figure out how to add them to the array. I greatly appreciate any help you can give, and please keep in mind that I much prefer simplicity over small size. Thank you in advance!

P.S. Some responses I’ve seen for similar questions include what I think are arrays of strings. In order for the part of the program that I have working to still work, I think that I need to use an array of integers. If you’re curious, the rest of the code is used to determine if the numbers in the array are all different, in order to achieve the final result of determining if a number’s digits are all distinct. It looks like this:

int repeats=0;
int[] digitArray;
digitArray = new int[10];
for (int i = 0; i < digitArray.length; i++) 
    for (int j = 0; j < digitArray.length; j++)
        if ((i != j) && (digitArray[i]==digitArray[j])) unique = unique+1;
System.out.println(unique==0);
  • 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-06-18T15:07:27+00:00Added an answer on June 18, 2026 at 3:07 pm

    Method number.toString().length() will return the number of digits. That is the same as the length of your needed array. Then you use your code as before, yet instead of printing you add the digit to the array.

    int number = 1234567890;
    int len = Integer.toString(number).length();
    int[] iarray = new int[len];
    for (int index = 0; index < len; index++) {
        iarray[index] = number % 10;
        number /= 10;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am exceptionally new to programming, but I am working on improving my skills
Now I am exceptionally new to network programming so tell me if this is
It seems exceptionally heavy handed but going by the rule anything publicly available should
I'm working on a programming language that uses C++ as it's target language for
I am very new to VB.net and I am finding it exceptionally difficult to
I'm new to Ruby on Rails but it seems it creates a new session
I'm new to programming and I have a conceptual question. That is, can exception
As I was working on a project, I thought to myself Hmmm, it would
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem
I don't know much about web development, so probably this question will sound exceptionally

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.