Displaying Array Position not working in case of descending Order?

Hi,
I need to display the array position of the sorted array in Descending order. Here is my code.
     int[] in = {5,3,2,7};
          int[] newArr = new int[in.length];
          int[] na = new int[in.length];
          //copying into a new array
          for(int i=0;i<in.length;i++){               
               newArr[i] = in;     
          // code for descending order
          for(int j=0;j<in.length;j++){
          Arrays.sort(in);
          na[j] = in[in.length-(1+j)];
          }the sorted array will be will be {7,5,3,2} now according to this i need to display the array position of the sorted array which should be {3,0,1,2} i tried to compare newArr[i] with na[j] but am not gettin the result that i should be getting the same comparison is working in case of Ascending Order but not descending. Any suggestions or help will be appreciated.
Thanks and regards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

hi,
what you are doing is correct only, do not put sort method inside the for loop
and postion is correct also
int[] in = {5,3,2,7};
        int[] newArr = new int[in.length];
        int[] na = new int[in.length];
        //copying into a new array
        for(int i=0;i<in.length;i++){
            newArr[i] = in;
Arrays.sort(in);
// code for descending order
for(int j=0;j<in.length;j++){
na[j] = in[(in.length-1)-j];
System.out.println("Val --> "+na[j]);
System.out.println("Position --> "+j);

Similar Messages

  • NGS Sponsors authentication does not work in case user has non-English character in his password

    Hi,
    we are using the NAC Guest Server v 2.0.1 and have Sponsors authentication done through Radius servers. Radius servers are Microsoft IAS using AD.
    Sponsors user authentication works okay in case user's password includes English characters, but does not work in case an user uses national characters like for example Umlauts in German.
    On Radius server I can see these error messages:
    User XXXX was denied access.
    Reason = Authentication was not successful because an unknown user name or incorrect password was used.
    As soon as an user changes his password and uses English characters only, it resolves.
    I guess this might be that NGS uses different coding while sending a password to Radius server, but not sure.
    Appreciate if anyone knows a root cause and what could be a workaround. Unfortunately our AD policy allows users to use national characters and we can hardly change it. So a change on NGS or Radius side would be more viable.
    Many thanks for your help.

    A case has been opened at Cisco and it is now quite clear that it is a problem with coding.
    According to Cisco development team NGS uses UTF-8 coding to send the password, of course encrypted, to the Radius server. This cannot be changed within NGS. We use Radius Microsoft IAS Version 5.2.3790.3959 running on VMWare Windows 2003 SP2. More tests are scheduled to be performed.

  • In dubai FT,siri are not working in case when we move other country could we activate those feature in that country

    in dubai FT,siri are not working in case when we move other country could we activate those feature in that country

    Facetime is disabled in hardware per request of Dubai government. It
    will not work if you move to another country. If you move and wish to utilize
    Facetime, sell your iPhone before moving and get a new one at your new
    location.
    Apple has not announced if/when Siri will work in Dubai.

  • MDX -Children count function Not working in Case statement

    Hi,
    I am trying to create set when you slice with the Hierarchy member is leaf level , I want a output only that Leaf level .
    and When I slice with  the parent level , it has to give all the members below that parent level.
    But the problem here is when I select child member or leaf member , The first condition in the Case is not working
    WITH SET
    TESTSET AS
    CASE
    WHEN
     [Dimension].[Hierarchy].currentmember.children.count<0
    THEN
     [Dimension].[Hierarchy].currentmember
    ELSE
     DESCENDANTS([Dimension].[Hierarchy].Currentmember,,AFTER)
    END
    SELECT
    WBSSET ON 1,
    {} on 0
    FROM
     (SELECT {[Dimension].[Hierarchy].&[10]} ON COLUMNS FROM [CubeName])
    Thanks,
    Santosh

    Hi Santosh,
    I don't think Children count function not working in case statement, I have tested it on my local environment, here s the sample query for you reference.
    with member
    testset as
    case
    when
    [Geography].[Geography].currentmember.children.count<10
    then "X"
    else "OK"
    end
    select testset on 0,
    {[Geography].[Geography].[Country].members} on 1
    from
    [Adventure Works]
    In your scenario, the issue might be caused by the query isself, you can try to use IsLeaf Funcion to achieve your requirement. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms144932.aspx
    http://www.databasejournal.com/features/mssql/article.php/3633696/MDX-Operators-The-IsLeaf-Operator--Conditional-Logic-within--Calculations.htm
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=22
    Regards,
    Charlie Liao
    TechNet Community Support

  • My mini i pad 2 retina display screen is not work correctly after two days of buying appear some gray line on screen un furtunately i live in iran and i havnot access to any i pad store please guide me

    My mini i pad 2 retina display screen is not work correctly after two days of buying appear some gray line on screen un furtunately i live in iran and i havnot access to any i pad store please guide me

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
     Cheers, Tom

  • Why weren't we told that display mirroring would not work with a Mac older than 12 months?

    Why weren't we told that display mirroring would not work with a Mac older than 12 months?

    You were, just not directly. If you go to apple's mountain lion webpage, you'll see this note at the bottom:
    1. AirPlay Mirroring requires a second-generation Apple TV or later, and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer).
    http://www.apple.com/osx/whats-new/features.html

  • Scrollbar positions not working

    i got a tree like structure in jsp as
    Root
    --- Node1
    ---- ChildNode1
    --- Node2
    ---- ChildNode1
    ---- ChildNode2
    --- Node3
    ---- ChildNode1
    --- ChildNode1.1
    --- ChildNode1.2
    ---- ChildNode2
    .......and so on
    this is a dynamic tree . on click on each node the page is refreshed and the below child nodes are retrieved form the database.
    its all are working fine but my bug is on chicking on the each node, the page goes to the top again and again i ve to scroll down to position of the node what i have to do to hold on the scroll bar position where it is for the previous page.
    ive used ScrollTo() but its moving and again it goes to the top automatically wat to do

    Thanks for the suggestion, but I already looked before and
    after page 6, nothing has changed. I've been trying to create a new
    scrollbar with the instructions from the help on the UIScrollBar
    component, but the arrows on the scroll bar don't show up.
    I have the text in the text box showing up and changing with
    each page. But the scroll bars are not working. Here is the AS I
    have on frame 1:
    NarrativeText_bottom = narrative_text[_root.CurrentPgNumber];
    this.createClassObject(mx.controls.UIScrollBar, "my_sb");
    my_sb.setScrollTarget(InstanceName_0);
    my_sb.setSize(16,InstanceName_0._height);
    my_sb.move(NarrativeText_bottom =
    narrative_text[_root.CurrentPgNumber];
    this.createClassObject(mx.controls.UIScrollBar, "my_sb");
    my_sb.setScrollTarget(InstanceName_0);
    my_sb.setSize(16,InstanceName_0._height);
    my_sb.move(InstanceName_0._x + InstanceName_0._width,
    InstanceName_0._y);
    // Load text to display and define onData handler.
    var my_lv:LoadVars = new LoadVars();
    my_lv.onData = function(src:String) {
    if (src != undefined) {
    InstanceName_0.text = src;
    } else {
    InstanceName_0.text = "Error loading text.";
    ._x + InstanceName_0._width, InstanceName_0._y);
    // Load text to display and define onData handler.
    var my_lv:LoadVars = new LoadVars();
    my_lv.onData = function(src:String) {
    if (src != undefined) {
    InstanceName_0.text = src;
    } else {
    InstanceName_0.text = "Error loading text.";
    When I drag the component to the side of the text box, the
    instance name for the text field (InstanceName_0) automatically
    populates the _targetInstanceName property of the component, like
    it's supposed to. So why are the arrows on the scroll bar not
    showing up?? PLEASE HELP! thanks.

  • Indesign Bullet or number position not working

    I cannot get this feature to work (Indesign CS6)
    I have a very long list of numbered items (over 300), so there is too much space between the single and two digit numbers and the first letter, because of course the indent has to accomodate the three digit numbers.
    I select align RIGHT, and I expect the numbers to switch to the right, as if I had set a right align tab there before the first character.
    But nothing happens.
    It is not a case of not enough space, since there is enough and I even made it larger than necessary to see if that solved it but it did not.
    Am I misinterpreting what that the position feature is for or is this a bug of some sort?
    It did not work in my previous CS4 version of ID either.

    It's not intuitive, nor easy.
    I've had very similar problems getting numbered lists to correctly align right with "hang for ten" or "hang for a hundred" needed.
    The only thing I can suggest is keep "playing" with the first line and left indents.
    I've found it necessary to make that first line indent larger than I would have ordinarily expect.

  • ADC Studio Display 17" USB not working

    Hi,
    I hope someone can help.
    I have a 17" Apple Studio Display that connects via ADC left over from my old Powermac G4. I recently bought the new Mac Mini (Unibody) and an Apple DVI to ADC Display Adapter to use with the HDMI to DVI Adapter to connect with the Apple Display.
    This works perfectly however I have noticed the USB ports on the back of the display does not work. Could this be because the Apple DVI to ADC Display Adapter can not supply enough power via the connected HDMI to DVI Adapter to support the display and its USB ports? Is there a way too get them working again?
    Thanks.
    Chris

    Hi. Thanks for that. As you say there must be something wrong with my display's USB circuitry then.
    Just one more question, is the USB cable from the DVI to ADC adapter only for supplying power to the USBs on the display? Since the display's USBs are not working, will the adapter still work and power my display without using the USB connecter from this adapter? If so this will free up one of my USB2 ports on the mini.
    Thanks again.

  • Display Content is Not working in BI 7.4

    Hi All,
    In BW 7.4, I am trying to display content via Mange Infoprovider. Till 7.3 the data used to show in the BW system itself.
    Where as in 7.4 BW system display data redirecting to below URL and it’s calling a webdynpro APP called “rsdmdm_md_maintenance_app” as below URL
    http://host:port/sap/bc/webdynpro/sap/rsdmdm_md_maintenance_app?IOBJNM=ZDV_EMPID&sap-language=EN.
    Bu this URL giving 500 Internet server error.
    Can any one help with what I am missing here? In 7.4 is it possible to display content in BW system itself?
    Thanks in advance.
    Venky

    Hi,
    Please review following SAP Note. The new behavior (WebDynpro based Master Data maintenance) is now standard since SAP BW 7.4 SP05. Old SAPGui based screen is not possible anymore.
    The notes describes the SICF services you need to activate to make it work.
    My understanding is that old SAPGui based screen could not handle certain newer data types. As per SAP the new feature has some good benefits such as copy/paster multiple lines from spreadsheet.
    1997402 - Master data maintenance is not possible in old GUI based
    one
    1969105 - Master data maintenance for InfoObjects does not
    start
    517484
    - Inactive services in the Internet Communication Framework
    1969092 - Exception when launching master data maintenance for some
    InfoObjects; additional option for navigating to application log
    Hope this helps.
    btw: I only found out this week hard way as we just did SAP BW 7.4 upgrade. :-)
    Thank you with kind regards,
    Satya,
    Resolution
    It’s not possible to switch to old GUI Based Master data maintenance. Incase
    if new master data maintenance is not working please check:
    Check if services as described in note 517484 is active
    In transaction SICF activate services starting with RSDMDM*
    Check if note 1969092 is implemented already.
    See Also
    Additionally the new UI has some advantages like editing values directly
    within the tables, so it’s not required to edit the values one by one,  or the
    option to copy and paste values from a spreadsheet directly in to table.

  • Email notification mail not working in case of customer repository

    Hi Experts,
    We have the system MDM 7.1 SP06, we are not able to get the email notification for customer repository. For other repositories like material & vendor mails are working fine. I Have checked the following steps.
    1) Added notification step to the workflow between processes.
    2) Verified the email addresses of the workflow owner and the receiver of the notification.
    3) Verified that the mds.ini has the "MailServer=" setup to the right smtp.
    I have check in workflow history, it is showing notify step but not showing details of mail like send to, mail body. While in case of material repository, it was showing complete details like send to, mail body & all.
    Previously mails for customers were working fine. Kindly suggest the solution.
    Regards,
    Gaurang

    Hi Gaurang,
    Are the time parameter same for all the repositories?
    Create a dummy user and dummy workflow,and try to send mail from that workflow.
    If this works with some id then check with the Admin id which you are using.
    This way you can eliminate the possibility of id not working.Also it will tell you that user is corrupt or not.
    Check for log and traces,kindly provide with the post here.
    Thanks,
    Ravi

  • Problem in displaying Array Position?

    hi,
    I am having a problem in displaying the array position of a sorted Array
    for ex:
    int[] a = {4,3,1,7}for sorting the array i am using Arrays.sort(a); then the output will be
    a = {1,3,4,7}now according to this i need to display the array position of a before sorting like a should have the output {2,1,0,3} which should be the array position of the sorted array. Any help will be appreciated.
    Thanks.

    for (int i = 0 ; i < unsortedArray.length ; i++)
       for (int j = 0 ; j < sortedArray.length ; j++)
           if (unsortedArray[i] == sortedArray[j]) {
                 System.out.println("position for element "+i+" is "+j);
                 break;
           }notice that if you have duplicate values, the position of the duplicate will always be considered as the first occurence of this value

  • Why is Transform Tool "reverse position" not working??

    Hi.. I have a part that I want to reverse the pitches of so that I can record it as audio and then reverse it so that it is a reversed version of the sound, yet it's playing the right pitches at the proper time...
    I was under the impression that the transform tool could do this, however it is not working for me. Could some please enlighten me to my error?
    Here is a video of my efforts:
    http://collinatorstudios.com/video/transform.mov
    -patrick

    Nevermind.. I found this thread, where someone already brought this up.
    http://discussions.apple.com/thread.jspa?messageID=762890
    Someone said:
    "Position
    Time position of the event, referenced to the start of the MIDI Region (not of the song)."
    as silly as that is (if it's true), it still doesn't work when I set it to "all"... It only works if I drag the part to the beginning of the song...
    Apple should really hire me to help them fix this program.. (sigh).
    -p

  • NT Desktop Perference display icon is not working

    Hello:
    I am using ConsoleOne version 1.3.5 to manage our Novell servers, there
    is an User Package object, in Policies -> WinNT-2000 -> NT Desktop
    Preference -> Properties -> Desktop Preferences -> Settings, there is
    a "Display" icon to allow us to setup Wallpaper under the roaming profile
    for all workstations, but when I click on it, it is not working, please
    advise.
    Thanks.
    Kevin

    If you are running a local copy of ConSlowOne try running the .exe from
    the server - I have found that some of the ZEN features don't work running
    from a copy of ConSlowOne on the workstation.
    > > [email protected] wrote:
    > > > Hello:
    > > >
    > > > I am using ConsoleOne version 1.3.5 to manage our Novell servers,
    > there
    > > > is an User Package object, in Policies -> WinNT-2000 -> NT Desktop
    > > > Preference -> Properties -> Desktop Preferences -> Settings, there
    is
    > > > a "Display" icon to allow us to setup Wallpaper under the roaming
    > profile
    > > > for all workstations, but when I click on it, it is not working,
    > please
    > > > advise.
    > > >
    > > > Thanks.
    > > >
    > > > Kevin
    > > >
    > > >
    > >
    > > Does the wallpaper selected already exist on the workstation? I can't
    > > recall if this policy will bring down the wallpaper or not.
    > >
    > > Any chance there is a GPO also in place on the user/workstation that
    is
    > > over-riding this setting. ( There could be conflicts here.)
    > >
    > > Try using the GPO instead as this is a better supported solution.
    > > The NT Desktop Preferences is a hold-over to Windows NT days and pre
    > > Group Policies.
    > >
    > >
    > > --
    > > Craig Wilson
    > > Novell Product Support Forum Sysop
    > > Master CNE, MCSE 2003, CCN
    >

  • Display form  function not working at HRADMIN level.

    Hi ,
    I have got a problem with   an  Adobe interactive form at HRADMIN level. i could run the perform personnel Actions(connecting to R/3), Email functions from the Action Box at  HRADMIN . when i try for the Display form , the page is refreshing it self and not getting  displayed .
    needs some help.
    Rgds,
    Venkat

    Thanks for your reply.
    I have set the rendered property to ${oa.viewobjectname.columnname}
    which is same as u mentioned I guess. It is working based on the first row fetched but not based on each rows value.
    As per Ramkumar in the below thread , SPEL does not work at row level is it TRUE can anypne confirm?
    Re: Bound Values
    I have been waiting to get someresponse from yesterday.
    Anyway, as My plan was to use the logic to build review page ( to show Blue dot if old value is not equals to new value) , I have planned to replace SPEL with oracle SQL logic I wrote a sql which returns something like this, I could not find any better alternates ( wrost one was to create 7 VO's (bcaz i have 7 columns to disp) and apply SPEL there)
    Select 'Empno' column, AEmpno Current,Bempno Proposed,decode( a.empno,b.empno,'','*') from xxx_v
    union
    Select 'Ename',Aename,Bename,decode(aename,bename,'','*') from xxx_v
    * indicates Changed data.

Maybe you are looking for

  • Officejet 6500A won't print

    My officejet 6500A plus won't print often.  It says it can't communicate with my Asus pc.   I unplug it for a day or two and it starts printing!  Just turning it off doesn't help.  I need to unplug it.  Meanwhile I can't print for days!  Any suggesti

  • Are the Technet forums getting .... s...l...o.....w.......e........r......?

    Just wondering if it's my laptop, the client I'm at, or ... Oracle? I suspect it's not me or my client as I still get other work related answers very quickly (you know ... weather.com, jokes.com, hotmail, yahoo - you know ... work stuff!). I can unde

  • Exception is thrown when creating bean

              Hi, I have some questions about transaction.           In my case, i call a stateful session bean through the stateless session bean.           When the bean is created, following exception is thrown           "javax.transaction.Transaction

  • Aggregate by Date

    Hi, Someone know how i make a SELECT statement using aggregate functions(MIN, MAX, COUNT, AVG, SUM) GROUP BY date interval(DAY, WEEK, MONTH, YEAR)? thanks...

  • Report row check and browser refresh

    I've selected some rows in a region report with the checkbox column. After refreshing the page in the browser the marking is still there on those rows. How can I make it disappear automatically on refresh?