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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:59:11+00:00 2026-05-27T08:59:11+00:00

I have a problem with arrays in java. I have a array: double[][] tab2

  • 0

I have a problem with arrays in java.
I have a array:

double[][] tab2 = {{318, 0.0825},
                  {321, 0.1131},
                  {309, 0.0283},
                  {319, 0.0830}};

and I need to change that array to:

double[][] tab2 = {{318, 0.0830},
                  {321, 0.0283},
                  {309, 0.1131},
                  {319, 0.0825}};

This is what i mean. I have four numbers. In this example 318, 321, 309 and 319. Every number is connected with another number, like 318 – 0.0825, 321 – 0.1131, etc. I need change value second values. When number which is connected with the biggest number should be connected with the smaller eg. 321 – 0.1131 should be 321 – 0.0283, 318 – 0.00830 should be 318 – 0.0825. It is possible to do this things?

  • 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-27T08:59:12+00:00Added an answer on May 27, 2026 at 8:59 am

    It would be easier to do this if the arrays were arranged in transposed form.

    double[][] tab3 = {
        {318.0, 321.0, 309.0, 319.0},
        {0.0830, 0.1131, 0.0283, 0.0830}}
    

    You can then sort the first array (tab3[0]) in ascending order and then the second array (tab3[1]) in descending order. Then all of the array indexes will line up and match the largest to the smallest. double[0][0] will be the biggest and double[1][0] will be the smallest, matching 309 and 0.1131 together.

    double[][] tab3 = {
        {309.0, 318.0, 319.0, 321.0},
        {0.1131, 0.0830, 0.0830, 0.0283}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem using JSON and arrays. Here is my code: while($row =
I have a problem with random and arrays. I have a list empty list
I have a problem initializing an array whose size is defined as extern const.
I have problem i need to convert from my Array structure to std::vector<int> ...
I have some problem to order an array by a field of this, here
I have a problem with initialzing a 2D array in python. I want a
I have a problem with some numpy stuff. I need a numpy array to
I have a problem with Javascript Literal functions. for (curitem in array) { var
I am trying to fix a array problem where it stores images into arrays
I'm just starting out with learning Java, and have run into a problem. When

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.