Sorting-related issues (Jq,java) _1123

Source: Internet
Author: User

The data list<string,object> Behaviordata are as follows:

What I'm going to do is show this list of the top four (except [0] of that hundred percent) data. displayed on the page.

List<behaviordata> Behaviordata = This. Behaviorservice.searchbehaviorbycondition (behavioranalysis);//To calculate the illegal behavior through the cycle TOP4        float[] BehaviorTop4 =New float[Behaviordata.size ()-1];  for(inti = 1; I <behaviordata.size (); i++) {String percent=Behaviordata.get (i). Getviolationproportion (); if(percent!=NULL) {Behaviortop4[i-1] = float.parsefloat (percent.replace ("%", "" "));        }} arrays.sort (BEHAVIORTOP4); List<BehaviorData> BEHAVIORNUM4 =NewArraylist<behaviordata>();  for(inti = 1; I <=4; i++) {Float x= behaviortop4[behaviortop4.length-i]; DecimalFormat DF=NewDecimalFormat ("0.00");            Df.format (x); String value= x+ "%";  for(intj = 0; J < Behaviordata.size (); J + +) {                if(Value.equals (Behaviordata.get (j). Getviolationproportion ())) {Behaviordata Mer=NewBehaviordata ();                    Mer.setviolationproportion (value);                    Mer.setbehaviorname (Behaviordata.get (j). Getbehaviorname ());                    Behaviornum4.add (MER);  Break; }            }        }

Sorting-related issues (Jq,java) _1123

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.