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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:57:11+00:00 2026-05-21T10:57:11+00:00

I have a number 0127 i am trying logic to generate number following sequence

  • 0

I have a number 0127

i am trying logic to generate number following sequence in JAVA

0
1
2
7
01
12
27
012
127
0127
1270
2701
7012
01270
12701
27012
.
.

I am breaking my head 🙂

  • 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-21T10:57:12+00:00Added an answer on May 21, 2026 at 10:57 am

    I would convert the number to a String object, then to an array of chars.

    From there, you can iterate over the array with the following logic:

            int MAX_LENGTH = 10;
            char[] array = "0127".ToCharArray();
            for (int i = 0; i < MAX_LENGTH; i++)
            {
                for (int offset = 0; offset < array.Length; offset++)
                {
                    String disp = "";
                    for (int j = 0; j <= i; j++)
                    {
                        int index = j + offset;
                        while (index >= array.Length)
                            index -= array.Length;
                        disp += array[index];
                    }
                    Console.WriteLine(disp);
                }
            }
    

    Change MAX_LENGTH to be what ever the maximum length of the output string should be.

    Here is the output that this code produces:
    enter image description here

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

Sidebar

Related Questions

I'm stuck with the following scenario and appreciate any help/advice.. Requirement I have number
Say I have the following code: private Integer number; private final Object numberLock =
Hi I'm trying to write my first report!!! and have number of question I
http://www.exampledepot.com/egs/java.text/FormatNum.html i have number 1.23 and i want to format it to 1,23. But
I have number of line breaks in a string. But I only want it
I have a number input that should trigger jQuery on every change. To do
I have a number of classes and they are quite close to each other
We have a number of data objects that realize INotifyPropertyChanged to allow for WPF
I have a number of classes (more than 40), each one has a number
I have a number of aliases defined in my .bashrc . E.g: alias ls='ls

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.