java 彩票走势图算法

本文详细介绍了彩票走势图中遗漏值、出现总次数、平均遗漏值、最大遗漏值和最大连出值的计算逻辑,结合具体双色球案例,通过Java工具类进行计算,并展示返回给前端的JSON数据。
摘要由CSDN通过智能技术生成

一、算法介绍

本博文主要写了彩票走势图中的遗漏值、出现总次数、平均遗漏值、最大遗漏值、最大连出值的计算逻辑。

二、图文简介

[这是XX网双色球的彩票走势图,博主这里是将彩票数据分区展示,以双色球为例,分了五个区域,本博文中的遗漏值是按照期数的降序排列计算的如下图]

这里写图片描述

三、工具类简介(请仔细看完工具类简介)

彩票走势图的工具类**LotteryTrend**中将彩票的名称彩票的id,及其对应的数字域数据域id,每个区域的起始数字,每个区域的长度等数据按照顺序一一对应定义。另一个工具类**MissValue**就是彩票遗漏值的工具类,里面是具体的**彩票遗漏值、出现总次数、平均遗漏值、最大遗漏值、最大连出值**的计算方法,博主将开奖位置的遗漏值置为0,返给前端的。下面是这几个名词的定义:
**彩票遗漏值**:自上期开出到本期间隔的期数。
**出现总次数**:当前选定的彩票期数区间内该球的出现总次数。
**平均遗漏值**:平均遗漏值计算公式:总期数除以出现的总次数,如果总次数为0,该值为0;如果除不尽将计算结果向下取整。
**最大遗漏值**:历史开奖以来该球连续不出现的最大值,即为距离上次出现的间隔数的最大值。
**最大连出值**:**博主写的是选定期数内连续出现的最大值,与右图不符合**.

四、返回给前端的json数据

五、代码块

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;


/**
 * 彩票走势图工具类
 * @author Administrator
 *
 */
public class LotteryTrend {
   

    //所有彩票名称数组
    public static final String[] titleArray={
  "超级大乐透","七星彩","排列三","排列五","双色球","福彩3D","江西11选5","11运夺金","广东11选5","上海11选5","浙江11选5","七乐彩","重庆时时彩","胜负彩","安徽快三","湖北快三","吉林快三","江苏快三","江苏11选5","浙江12选5"};

    //彩票的id数组
    public static final String[] lotteryidArray={
  "19","18","2","13","16","1","9","8","10","24","27","17","3","71","32","33","34","35","28","22"};
    //每种彩票的区域或者数字域
    public static final String[][] headArray={
  {
  "红一区","红二区","红三区","后区"},{
  "第七位","第六位","第五位","第四位","第三位","第二位","第一位"},{
  "百位","十位","个位"},
            {
  "万位","千位","百位","十位","个位"},{
  "红一区","红二区","红三区","篮球"},{
  "百位","十位","个位"},
            {
  "万位","千位","百位","十位","个位"},{
  "万位","千位","百位","十位","个位"},{
  "万位","千位","百位","十位","个位"},
            {
  "万位","千位","百位","十位","个位"},{
  "万位","千位","百位","十位","个位"},{
  "一区","二区","三区"},
            {
  "万位","千位","百位","十位","个位"},{
  "3","1","0"},{
  "百位","十位","个位"},
            {
  "百位","十位","个位"},{
  "百位","十位","个位"},{
  "百位","十位","个位"},
            {
  "万位","千位","百位","十位","个位"},{
  "万位","千位","百位","十位","个位"}};

    //区域或者数字域的id
    public static final String[][] idxArray ={
  {
  "area1","area2","area3","back"},{
  "num_info7","num_info6","num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "num_info3","num_info2","num_info1"},
            {
  "num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "area1","area2","area3","num_info7"},{
  "num_info3","num_info2","num_info1"},
            {
  "num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "num_info5",
            "num_info4","num_info3","num_info2","num_info1"},{
  "num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "num_info5","num_info4","num_info3","num_info2","num_info1"},
            {
  "area1","area2","area3"},{
  "num_info5","num_info4","num_info3","num_info2","num_info1"},{
  "3","1"</
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值