zoukankan      html  css  js  c++  java
  • 生成随机删除的航班信息

    package nicetime.com.baseutil;

    import java.util.Random;

    /**
    * @author nicetime
    * @create 2018-10-14 16:06
    */
    public class FlightUtil
    {
    public static void main(String[] args)
    {

    //获取航班记录数
    // String count="${flightSn_matchNr}";

    String count="3";
    int flightCount=Integer.valueOf(count);

    String unsubscribeUrl=null;

    // log.info("aaa");

    //确定要循环的次数
    int line=0;

    //随机删除的航班序号数
    int index=0;

    //航班序号
    String flightSnstr=null;

    //航班号信息
    String flightKeystr=null;

    //航班信息是否存在
    boolean hasFlightinfo=false;

    if(flightCount!=0)
    {
    // log.info("bbbb");

    line=flightCount;

    Random rand =new Random();

    //生成0-5之间的整数
    index=rand.nextInt(line);

    StringBuffer strb=new StringBuffer();

    for(int i=0;i<=line;i++)
    {
    // log.info("ddd");
    if(i!=0)
    {

    String key=null;
    String sn=null;

    key="flightKey_".concat(String.valueOf(i));
    sn="flightKey_".concat(String.valueOf(i));

    flightKeystr="${key}";
    flightSnstr="${sn}";

    strb.append("flightID=").append(flightKeystr).append("&");
    strb.append(".cgifields=").append(flightSnstr).append("&");
    }
    }

    strb.append(index).append("=on&removeFlights.x=27&removeFlights.y=5");
    unsubscribeUrl=strb.toString();

    // log.info("fff");

    hasFlightinfo=true;

    System.out.println("unsubscribeUrl= "+unsubscribeUrl);
    }

    // log.info("gggg");
    // vars.put("index",String.valueOf(index));
    // vars.put("unsubscribeUrl",unsubscribeUrl);
    // log.info("hhh");

    }
    }

  • 相关阅读:
    数据结构实现(四)二叉查找树java实现
    数据结构实现(三)二叉树
    git
    抓包原理
    数据结构实现(二)队列
    86. Partition List
    82. Remove Duplicates from Sorted List II
    83. Remove Duplicates from Sorted List
    排序算法总结
    上下文切换详解
  • 原文地址:https://www.cnblogs.com/NiceTime/p/10023940.html
Copyright © 2011-2022 走看看