Java基础之常用类

news2024/10/6 8:27:53

Java基础之常用类

  • 一、包装类
    • 1.1、Java基本数据类型及其对应的包装类
    • 1.2、包装类的自动装箱、自动拆箱机制
    • 1.3、包装类的优点
  • 二、String类
  • 三、StringBuffer类和StringBuilder类
    • 3.1、主要区别:
    • 3.2、StringBuffer/StringBuilder用法(两者用法一致)
  • 四、日期类
    • 4.1、Date类
    • 4.2、SimpleDateFormate和DateFormate类
    • 4.3、Calender类日期类
  • 五、JDK8日期类
    • 5.1、LocalDate
    • 5.2、LocalTime
    • 5.3、LocalDateTime
    • 5.4、ZoneDateTime
  • 六、Math类和Random类
    • 6.1、Math类
    • 6.2、Random类
  • 七、枚举类
  • 八、System类

一、包装类

Java包装类(Wrapper Classes)是一组用于将基本数据类型转换为对象的类。均位于java.lang包内

1.1、Java基本数据类型及其对应的包装类

基本数据类型包装类
整数类型byteByte
shortShort
intInteger
longLong
浮点类型floatFloat
doubleDouble
字符类型charCharacter
布尔类型booleanBoolean

1.2、包装类的自动装箱、自动拆箱机制

  • 创建一个包装类
Integer num = new Integer(0);    //创建一个数值为0的Integer对象
  • 基本类型数据和包装类对象互换
Integer num1= new Integer(8);//基本数据类型-->包装类
int num2=num1.intValue();//包装类转换成基本数据类型
System.out.println(num1+" "+num2);

//1、包装类中的自动装箱拆箱机制
Integer  num1 = 1;		//自动装箱
int num2 = num1;		//自动拆箱
System.out.println(num1 +"	"+ num2);

1.3、包装类的优点

  • 某些方法参数必须为对象,包装类使数据类型转换成对象
  • 获得类型的最大值:Integer.MAX_VALUE
  • 最小值Integer.MIN_VALUE
  • 将一个类型转为另一个类型integer.doubleValue()
  • 将字符串转化为数字Integer.parseInt(“100”)
  • 将数字转化为字符串Integer.toString(100)

二、String类

String 是 Java 中的一个类,用于表示字符串。在 Java 中,字符串是不可变的,这意味着一旦创建了一个字符串对象,就不能再修改它的内容。String 类位于 java.lang 包中,因此在大多数情况下不需要显式导入。

import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @BelongsProject: Test
 * @BelongsPackage: FaceObject
 * @Author: Jorya
 * @CreateTime: 2023-11-21  22:26
 * @Description: TODO
 * @Version: 1.0
 */
public class TestString {

    public static void main (String[] args){
        //①字符串的创建
        // 使用字面值创建字符串
        String str1 = "Hello, World!";
        String str2 = "Hello, World!";//这两个的地址是一样的,并没有重新生成一个字符串
        System.out.println(str1==str2);//true
        // 使用构造函数创建字符串
        String str3 = new String("Hello, World!");
        String str4 = new String("Hello, World!");
        System.out.println(str3==str4);//判断是否全部一样,因为是不同对象。False
        System.out.println(str3.equals(str4));//equals是判断内容是否相等:true
        System.out.println(str3.equalsIgnoreCase(str4));// 忽略大小写比较
        System.out.println(str3.compareTo(str4));//判断字符串是否相等,区分大小写

        //②字符串的链接
        // 使用加号进行字符串连接
        String fullName = str1 + " " + str2;
        // 使用 concat 方法
        String fullNameConcat = str1.concat(" ").concat(str2);
        System.out.println(fullName);

        System.out.println(str1.length());//获取字符串长度
        System.out.println(str1.isEmpty());//判断字符串是否为空
        System.out.println(str1.endsWith("!"));//判断字符串是否以!结尾
        System.out.println(str1.startsWith("H"));//判断字符串是否以H开始
        System.out.println(str1.toUpperCase());//全部转换为大写
        System.out.println(str1.toLowerCase());//全部转换为小写
        System.out.println(str1.charAt(2));//获得字符串的第3个字符l;java的下标是从0开始的
        System.out.println(str1.toCharArray());//字符串转数组
        System.out.println(str1.indexOf("l"));//查找字符串第一次出现的位置
        System.out.println(str1.indexOf("l",2));//从指定位置查找字符串第一次出现的位置
        System.out.println(str1.lastIndexOf("o"));//从后往前查找字符串第一次出现的位置
        System.out.println(str1.substring(2));//从指定位置截取字符串
        System.out.println(str1.substring(2,5));//截取中间某处的字符串
        System.out.println(str1.substring(7)); // 从索引 7 开始截取到字符串末尾
        System.out.println(str1.contains("World")); //检查字符串包括
        System.out.println(str1.replace("World", "Java"));  //字符串替换
        
        //字符串分割
        String[] split = str1.split(" ");//按指定字符串分割字符串
        System.out.println(Arrays.toString(split));

        //去掉首尾空格
        String str5 = "   Trim Me   ";
        String trimmedStr = str5.trim();
        
        //字符串格式化
        String name = "John";
        int age = 25;
        String formattedString = String.format("Name: %s, Age: %d", name, age);
    }
}

三、StringBuffer类和StringBuilder类

StringBuffer和StringBuilder类用法几乎一模一样,都为抽象类、是AbstractStringBuilder的子类

3.1、主要区别:

StringBufferStringBuilder
线程安全线程不安全
效率较慢效率快、建议使用
方法同步、适用于多线程不提供同步、适用于单线程
//比较String、StringBuilder、StringBuffer的运行时间
public class StringBufferTest {
	public static void main(String[] args) {
		long startTime, endTime;

		// 使用 String 拼接
		String s1 = "";
		startTime = System.currentTimeMillis();
		for (int i = 0; i < 100000; i++) {
			s1 = s1.concat("拼接");
		}
		endTime = System.currentTimeMillis();
		System.out.println("String 用时: " + (endTime - startTime) + "ms,长度:" + s1.length());

		// 使用 StringBuilder 拼接
		StringBuilder s2 = new StringBuilder();
		startTime = System.currentTimeMillis();
		for (int i = 0; i < 1000000; i++) {
			s2.append("拼接");
		}
		endTime = System.currentTimeMillis();
		System.out.println("StringBuilder 用时: " + (endTime - startTime) + "ms,长度:" + s2.length());

		// 使用 StringBuffer 拼接
		StringBuffer s3 = new StringBuffer();
		startTime = System.currentTimeMillis();
		for (int i = 0; i < 1000000; i++) {
			s3.append("拼接");
		}
		endTime = System.currentTimeMillis();
		System.out.println("StringBuffer 用时: " + (endTime - startTime) + "ms,长度:" + s3.length());
	}
}

在这里插入图片描述

3.2、StringBuffer/StringBuilder用法(两者用法一致)

// 创建一个空的 StringBuffer
StringBuffer buffer = new StringBuffer();
// 添加字符串
buffer.append("Hello");
// 在特定位置插入字符串
buffer.insert(5, ", World!");
// 替换字符串
buffer.replace(0, 5, "Hi");
// 删除字符串
buffer.delete(3, 6);
// 反转字符串
buffer.reverse();
// 获取字符串长度
int length = buffer.length();
// 转换为字符串
String result = buffer.toString();

四、日期类

4.1、Date类

在 Java 中,Date 类用于表示日期和时间。请注意,Date类在 Java 8 之后已经过时,更推荐使用 java.time 包中的新日期和时间 API(java.time 包中的类,如 LocalDateLocalTimeLocalDateTime

import java.util.Date;
//日期类
public class TestDate {
    public static void main(String[] args) {
      Date currentDate = new Date();
        System.out.println(currentDate);
        System.out.println(currentDate.getTime());//获取1970年1月1日到现在的毫秒数
        System.out.println(currentDate.toLocaleString());//获取当前时间的字符串

        int year = currentDate.getYear() + 1900;        // 获取年份(从1900开始)
        int month = currentDate.getMonth() + 1; // 获取月份(从0开始,需要加1)
        int day = currentDate.getDate();// 获取日期
        // 获取小时、分钟、秒
        int hours = currentDate.getHours();
        int minutes = currentDate.getMinutes();
        int seconds = currentDate.getSeconds();

        java.sql.Date date1 = new java.sql.Date(System.currentTimeMillis());
        System.out.println(date1);//只有年月日
        String t="2019-8-20";
        java.sql.Date date2 = java.sql.Date.valueOf(t);//将字符串转化为日期
        System.out.println(date2);
    }
}

4.2、SimpleDateFormate和DateFormate类

import java.text.DateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
//日期类
public class TestDate {
    public static void main(String[] args) {
        Date currentDate = new Date();

        // 创建 SimpleDateFormat 对象并指定日期格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 格式化日期
        String formattedDate = sdf.format(currentDate);
        System.out.println("SimpleDateFormat Date: " + formattedDate);

        //创建格式化日期格式为:"yyyy-MM-dd hh:mm:ss";因为DateFormat是一个抽象类不能new对象,所以new一个他的子类;这叫多态
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String format = dateFormat.format(currentDate);//格式化这个日期类,返回String字符串
        System.out.println("DateFormat Date: "+format);//2022-05-16 10:03:29
    }
}

SimpleDateFormat sdf = new SimpleDateFormat(“日期格式字符串”);
日期格式字符串,如:“yyyy-MM-dd hh:mm:ss”
yyyy 代表4位的年份
MM 代表2位的月份
dd 代表2位的日期
hh/HH 12小时制/24小时制
mm 代表分钟
ss 代表秒钟
a 代表AM/PM

4.3、Calender类日期类

import java.text.SimpleDateFormat;
import java.util.*;

public class TestCalendar {
    public static void main(String[] args) {
        //Calendar这也是一个抽象类,需要new他的子类
        Calendar calendar = new GregorianCalendar();
        System.out.println(calendar);
        System.out.println(calendar.get(Calendar.YEAR));//获取年月日
        System.out.println(calendar.get(Calendar.MARCH)+1);//月是从0开始的
        System.out.println(calendar.get(Calendar.DATE));

        System.out.println(calendar.getActualMaximum(Calendar.DATE));//获取当前月最大天数

        //日期类和日历类相互转化
        // 1. Date 转 Calendar
        Date currentDate = new Date();
        Calendar calendarFrom = Calendar.getInstance();
        calendarFrom.setTime(currentDate);
        // 输出 Calendar 对象的日期和时间
        System.out.println("1. Calendar from Date:");
        printCalendar(calendarFrom);
        // 2. Calendar 转 Date
        Calendar calendarTo = Calendar.getInstance();
        calendarTo.set(2023, Calendar.JANUARY, 1); // 2023-01-01
        Date date = calendarTo.getTime();
        // 输出转换后的 Date 对象
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("\n2. Date from Calendar: " + sdf.format(date));
    }
    private static void printCalendar(Calendar calendar) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("  Time: " + sdf.format(calendar.getTime()));
    }
}

五、JDK8日期类

​ 在 Java 8 中,引入了新的日期和时间 API,这个 API 位于 java.time 包中。以下是一些 Java 8 中日期和时间 API 的常用类:

属性含义
Instant代表的是时间相当于Date
LocalDate代表日期,比如2022-01-14
LocalTime代表时间,比如12:20:30
LocalDateTime代表具体时间,比如2022-01-14 12:20:30
ZonedDateTime代表一个包含时区的完整的日期时间
DateTimeFormatter日期和字符串格式转换

5.1、LocalDate

import java.time.LocalDate;

public class LocalDateExample {
    public static void main(String[] args) {
        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        // 创建指定日期
        LocalDate specificDate = LocalDate.of(2023, 1, 1);
        // 获取日期属性
        int year = specificDate.getYear();
        int month = specificDate.getMonthValue();
        int dayOfMonth = specificDate.getDayOfMonth();
        int dayOfWeek = specificDate.getDayOfWeek().getValue();
        int dayOfYear = specificDate.getDayOfYear();
        // 在当前日期基础上加上一天
        LocalDate nextDay = currentDate.plusDays(1);
        // 在当前日期基础上减去一周
        LocalDate lastWeek = currentDate.minusWeeks(1);
    }
}

5.2、LocalTime

import java.time.LocalTime;

public class LocalTimeExample {
    public static void main(String[] args) {
        // 获取当前时间
        LocalTime currentTime = LocalTime.now();
        // 创建指定时间
        LocalTime specificTime = LocalTime.of(12, 30, 45);
        // 获取时间属性
        int hour = specificTime.getHour();
        int minute = specificTime.getMinute();
        int second = specificTime.getSecond();
        int nano = specificTime.getNano();
        // 在当前时间基础上加上一小时
        LocalTime nextHour = currentTime.plusHours(1);
        // 在当前时间基础上减去半小时
        LocalTime halfHourAgo = currentTime.minusMinutes(30);
    }
}

5.3、LocalDateTime

import java.time.LocalDateTime;

public class LocalDateTimeExample {
    public static void main(String[] args) {
        // 获取当前日期和时间
        LocalDateTime currentDateTime = LocalDateTime.now();
        // 创建指定日期和时间
        LocalDateTime specificDateTime = LocalDateTime.of(2023, 1, 1, 12, 30, 45);
        // 在当前日期和时间基础上加上一天
        LocalDateTime nextDay = currentDateTime.plusDays(1);
        // 在当前日期和时间基础上减去一周
        LocalDateTime lastWeek = currentDateTime.minusWeeks(1);
    }
}

5.4、ZoneDateTime

import java.time.ZonedDateTime;
import java.time.ZoneId;

public class ZonedDateTimeExample {
    public static void main(String[] args) {
        // 获取当前日期和时间(带时区信息)
        ZonedDateTime currentDateTimeWithZone = ZonedDateTime.now();
        // 创建指定日期和时间(带时区信息)
        ZonedDateTime specificDateTimeWithZone = ZonedDateTime.of(2023, 1, 1, 12, 30, 45, 0, ZoneId.of("America/New_York"));
        // 在当前日期和时间基础上加上一天(带时区信息)
        ZonedDateTime nextDayWithZone = currentDateTimeWithZone.plusDays(1);
        // 在当前日期和时间基础上减去一周(带时区信息)
        ZonedDateTime lastWeekWithZone = currentDateTimeWithZone.minusWeeks(1);
    }
}

六、Math类和Random类

6.1、Math类

java.lang.Math 类包含用于执行基本数学运算的静态方法。这些方法提供了对常见数学函数的访问,如三角函数、指数函数、对数函数等。

public class MathExample {
    public static void main(String[] args) {
        // 基本数学运算
        int sum = Math.addExact(5, 3); // 返回两个整数的和,溢出时抛出异常。
        int difference = Math.subtractExact(8, 3); // 返回两个整数的差
        int product = Math.multiplyExact(4, 7); //返回两个整数的积
        int incremented = Math.incrementExact(10); // 返回参数的值加 1
        int decremented = Math.decrementExact(7); //返回参数的值减 1
        int negated = Math.negateExact(9); // 返回参数的负值

        // 取整和舍入
        double ceilValue = Math.ceil(3.14); // 4.0 返回不小于参数的最小整数
        double floorValue = Math.floor(3.14); // 3.0 返回不大于参数的最大整数
        long roundedValue = Math.round(3.14); // 3 返回参数最接近的整数

        // 指数和对数
        double expValue = Math.exp(2.0); // 7.3890560989306495  返回自然数底数 e 的指数
        double logValue = Math.log(10.0); // 2.302585092994046   返回参数的自然对数
        double powValue = Math.pow(2.0, 3.0); // 8.0  返回 a 的 b 次幂

        // 三角函数
        double sinValue = Math.sin(Math.toRadians(30)); // 0.49999999999999994 返回角的正弦
        double cosValue = Math.cos(Math.toRadians(60)); // 0.5000000000000001返回角的余弦
        double tanValue = Math.tan(Math.toRadians(45)); // 0.9999999999999999 返回角的正切
    }
}

6.2、Random类

  • 构造

    Random random =new Random();
    
  • 获得随机数

    Random.nextInt(100);
    

    代码示例:

    import java.util.Random;
    public class TestRandom {
        public static void main(String[] args) {
            Random random = new Random();
            System.out.println(random.nextInt(100));//获取100以内的随机整数
            System.out.println(random.nextFloat());//获取浮点随机
        }
    }
    

七、枚举类

所有的枚举类型隐性地继承自java.lang.Enum, 枚举的实质还是类。

代码示例:

// 定义一个简单的枚举类型
enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}

public class EnumExample {
    public static void main(String[] args) {
        // 使用枚举常量
        Day today = Day.MONDAY;
        System.out.println("Today is " + today);

        // 枚举常量的比较
        if (today == Day.MONDAY) {
            System.out.println("It's a workday.");
        }

        // 遍历枚举值
        System.out.println("Days of the week:");
        for (Day day : Day.values()) {
            System.out.println(day);
        }
    }
}

八、System类

  • System.in : 标准输入流
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = scanner.nextLine();
System.out.println("Hello, " + name + "!");
  • System.exit(int status) :退出程序
System.exit(0); // 正常退出
System.exit(1); // 异常退出
  • System.currentTimeMillis() :获取当前时间毫秒数
long currentTimeMillis = System.currentTimeMillis();
System.out.println("Current time in milliseconds: " + currentTimeMillis);

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1271159.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

单点登录平台设计

1.基本介绍 1.1什么是单点登录 单点登录&#xff08;Single Sign-On&#xff0c;简称SSO&#xff09;是一种身份认证的解决方案&#xff0c;它允许用户只需一次登录即可访问多个应用程序或系统。在一个典型的SSO系统中&#xff0c;用户只需通过一次身份认证&#xff0c;就可以…

CV计算机视觉每日开源代码Paper with code速览-2023.11.27

点击CV计算机视觉&#xff0c;关注更多CV干货 论文已打包&#xff0c;点击进入—>下载界面 点击加入—>CV计算机视觉交流群 1.【图像分割】SEGIC: Unleashing the Emergent Correspondence for In-Context Segmentation 论文地址&#xff1a;https://arxiv.org//pdf/2…

SpringCloudAlibaba微服务 【实用篇】| Nacos配置管理

目录 一&#xff1a;Nacos配置管理 1. 统一配置管理 2. 配置热更新 3. 配置共享 4. 搭建Nacos集群 tips&#xff1a;前些天突然发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家&#xff0c;感兴趣的同学可以进…

nginx: [alert] could not open error log file

先把cmd的报错信息粘出来 nginx: [alert] could not open error log file: CreateFile() “logs/error.log” failed (3: The system cannot find the path specified) 2023/11/29 11:27:37 [emerg] 5040#18772: CreateDirectory() “D:\enviroment\nginx-1.24.0\conf/temp/cli…

c#把bitmap格式转换为其他格式图片

增加引用命名空间 using System.Drawing.Imaging; 打开对话框的方式读入bmp格式图片&#xff0c;转换为其他格式。 也可以直接传入图片名称。 OpenFileDialog ofd new OpenFileDialog();ofd.Title "打开对话框";ofd.InitialDirectory "D:/";ofd.Filt…

Python基础语法之学习占位符

Python基础语法之学习占位符 一、代码二、效果 一、代码 name "张三" sex "男" age 10 money 12.5# 通过占位符完成拼接 print("姓名&#xff1a;%s" % name) print("姓名&#xff1a;%s,性别&#xff1a;%s" % (name, sex))text…

nexus制品库的介绍及详细部署使用

一、nexus 介绍 Nexus 是一个强大的仓库管理工具&#xff0c;用于管理和分发 Maven、npm、Docker 等软件包。它提供了一个集中的存储库&#xff0c;用于存储和管理软件包&#xff0c;并提供了版本控制、访问控制、构建和部署等功能。 Nexus 可以帮助开发团队提高软件包管理的效…

直流负载与交流负载的作用

直流负载和交流负载都是用来消耗电能的装置或设备&#xff0c;它们的作用是将电能转化为其他形式的能量&#xff0c;以满足特定的需求。直流负载主要用于直流电路中&#xff0c;例如直流电源、电池等。它们可以将直流电能转化为热能、光能、机械能等。直流负载在很多领域都有广…

JavaScript图片处理大揭秘!掌握文件流处理方法

说在前面 &#x1f4bb;作为一名前端开发&#xff0c;我们平时也少不了对文件流数据进行处理&#xff0c;今天简单整理一下日常开发中比较常见的一些处理文件流的场景及处理方法&#xff0c;希望可以帮助到大家&#xff0c;挤出多一点的摸鱼学习时间。 常见场景 一、input框上…

uniapp + electron 打包项目

参考文献 1、控制台安装electron和electron打包工具electron-packager npm install electron -g npm install electron-packager -g2、manifest.json修改 运行的基础路径修改为&#xff1a;./ 不然打包出来会出现白屏&#xff0c;读取不到&#xff0c;因为打包出来的h5默认加…

强大的Kubernetes工具的完整指南

在容器化应用程序编排方面&#xff0c;Kubernetes是市场的领导者。它允许用户在多主机环境中管理容器&#xff0c;提供工作负载分配和网络处理。 此外&#xff0c;它还提供了许多在DevOps过程中至关重要的特性&#xff0c;例如自动扩展、自动修复和负载平衡。这些功能解释了Kub…

xcconfig(环境变量) 的使用

xcconfig&#xff08;环境变量&#xff09; 的使用 文章目录 xcconfig&#xff08;环境变量&#xff09; 的使用一、上手使用1、添加 xcconfig 文件2、在文件中添加数据3、将文件配置到工程中4、使用环境变量5、使用 Pod 的项目 二、语法1、注释&#xff1a;2、包含语句&#x…

C语言之“可变参数<stdarg.h>”

目录 前言 stdarg.h头文件 实例&#xff1a;遍历并求和所有传递给sum函数的额外实际参数 前言 有时我们会希望函数带有可变数量的参数就像printf&#xff08;cosnt char* format ...&#xff09;和scanf&#xff08;cosnt char* format ...&#xff09;那样除了有一个参数 …

ArkTS-文本滑动选择器弹窗

文本滑动选择器弹窗 根据指定的选择范围创建文本选择器&#xff0c;展示在弹窗上。 示例 Entry Component struct TextPickerDialogExample {State select: number 2private fruits: string[] [苹果, 香蕉, 橘子, 梨儿, 桃儿]build() {Row() {Column() {Text(当前选择为&…

windows系统bat脚本命令总结之reg命令

前言 做了一段时间的bat脚本开发&#xff0c;bat脚本中有各种各样的命令跟传统的编程逻辑完全不同&#xff0c;本专栏会讲解下各种各式的命令使用方法。 本篇文章讲解的是windows系统注册表操作命令"reg"。 reg命令简介 “reg” 是 Windows 操作系统中的一个命令行工…

关于前端学习的思考-浮动元素和块级元素的关系

先摆关系&#xff1a;浮动元素嵌套块级元素&#xff0c;浮动元素和块级元素是上下关系。 1、浮动元素为父盒子&#xff0c;块级元素为子盒子。 父盒子为浮动元素&#xff0c;子盒子不会继承。如图floatnone&#xff1b; 摆结论&#xff1a;子盒子为行内元素&#xff0c;行内块…

智能优化算法应用:基于群居蜘蛛算法无线传感器网络(WSN)覆盖优化 - 附代码

智能优化算法应用&#xff1a;基于群居蜘蛛算法无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用&#xff1a;基于群居蜘蛛算法无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.群居蜘蛛算法4.实验参数设定5.算法结果6.参考…

excel 计算断面水质等级

在工作中遇到根据水质监测结果要判断断面等级。写了下面的公式&#xff1a; 因子标准值 limits {COD: [15,15, 20, 15,20],氨氮: [0.15, 0.5, 1, 1.5, 2.0],总磷: [0.02, 0.1, 0.2, 0.3, 0.4] } excel公式&#xff1a; IFS(MAX(IF(M2>20,1,0), IF(N2>2,1,0), IF(O2&g…

夜莺项目发布 v6.4.0 版本,新增全局宏变量功能

大家好&#xff0c;夜莺项目发布 v6.4.0 版本&#xff0c;新增全局宏变量功能&#xff0c;本文为大家简要介绍一下相关更新内容。 全局宏变量功能 像 SMTP 的配置中密码类型的信息&#xff0c;之前都是以明文的方式在页面展示&#xff0c;夜莺支持全局宏变量之后&#xff0c;可…

SpringMvc集成开源流量监控、限流、熔断降级、负载保护组件Sentinel | 京东云技术团队

前言&#xff1a;作者查阅了Sentinel官网、51CTO、CSDN、码农家园、博客园等很多技术文章都没有很准确的springmvc集成Sentinel的示例&#xff0c;因此整理了本文&#xff0c;主要介绍SpringMvc集成Sentinel SpringMvc集成Sentinel 一、Sentinel 介绍 随着微服务的流行&…