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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:58:10+00:00 2026-06-04T19:58:10+00:00

I want to create my own range of numbers in Java, and still be

  • 0

I want to create my own range of numbers in Java, and still be able to use the normal ones. I just can’t seem to solve it! That is without hard coding every result.

Let’s say. Integers go like 0, 1, 2, 3, 4, 5, 6, 7, 8…. and so on (I know! there are also negative int’s)

Now, I’d like to make my own “numbers” that can be used both as integers and their own type.

A simple cut of the numbers range is 1, 2, 3, 5, 4, 7, 6, 9, 10, 11, 8, 13, 14, 15, 12, 17, 18, 19, 20, 21, 22, 23, 16… and so on… A sheet of the all numbers are shown below. (I don’t need any numbers above 767, but the next number is 512, then 769+ and so one.

1
2
3
5
4
7
6
9-11
8
13-15
12
17-23
16
25-31
24
33-47
32
49-63
48
65-95
64
97-127
96
129-191
128
193-255
192
257-383
256
385-511
384
513-767

Now lets call these numbers tni’s (opposite of int)

Let’s say I’d like to add (int)A to (tni)B This should be normal math. So if A = 4 and B = 6, the result will be 10, not 8.

But if I want to see which one of 2 tni’s are the highest. Let’s say A=8 and B=10, id will tell me that A is higher, as in the tni range, 8 comes after 10.

Is this possible?

  • 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-04T19:58:13+00:00Added an answer on June 4, 2026 at 7:58 pm

    The best way I see of doing this is to create an array denoting each ‘normal’ int’s position in the tni sequence.

    For example:

    int[] tniArray = new int[768];
    
    tniArray[0] = 0;
    tniArray[1] = 1;
    tniArray[2] = 2;
    tniArray[3] = 3;
    tniArray[4] = 5; //This is because the number 4 comes at position 5 in the tni sequence
    tniArray[5] = 4;
    tniArray[6] = 7;
    tniArray[7] = 6;
    tniArray[8] = 11;
    //etc.
    

    Then, you can compare them with a method like this:

    boolean IntGreaterThanTni(int Int, int Tni){
        return (Int > tniArray[Tni]);
    }
    

    Yes, this is a fairly inelegant solution, but it seems like you have an inelegant problem in the first place.

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

Sidebar

Related Questions

I want to create my own custom annotation (just like the Java style annotation)
I want to create my own SeekBar because I can't find anything like with
I want to create my own PHP web app where people can signin with
I want to create an website where users can create their own teaching resources,
I want to create own widget that will be able to interpret the text
I am learning Java and want to create my own IRC client. I have
I want to create my own email template without having to use third party
I want to create my own incremental backup solution using C#. How can I
i want to create my own custom admin-url in wordpress... how can i do?
I want to create an own charting control, which can be embedded and used

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.