当前位置:网站首页>Arrays常用方法
Arrays常用方法
2022-07-25 13:07:00 【翻出乱世】
package com.javaming.study.easyexcel.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class arraysUtilsUse {
public static void main(String[] args) {
int[] int1 = {1, 2, 3};
int[] int2 = {1, 2, 3};
int[] int4 = {5, 2, 33, 435, 2342, 234, 435, 6756, 867, 345, 67, 567};
List<String> list = new ArrayList<>();
list.add("ww");
List<String> list2 = new ArrayList<>();
list2.add("ww");
//元素比较
boolean b = Arrays.equals(int1, int2);
//元素比较
boolean equals = Arrays.equals(list.toArray(), list2.toArray());
//查找元素下标
int i = Arrays.binarySearch(int4, 435);
//元素排序
Arrays.sort(int4);
System.out.println(i);
//数组转String
System.out.println(Arrays.toString(int4));
String s = Arrays.toString(list.toArray());
System.out.println(Arrays.toString(int4));
System.out.println(s);
System.out.println(b);
System.out.println(equals);
}
}
6
[2, 5, 33, 67, 234, 345, 435, 435, 567, 867, 2342, 6756]
[2, 5, 33, 67, 234, 345, 435, 435, 567, 867, 2342, 6756]
[ww]
true
true
边栏推荐
- ThreadLocal&Fork/Join
- Online Learning and Pricing with Reusable Resources: Linear Bandits with Sub-Exponential Rewards: Li
- 错误: 找不到或无法加载主类 xxxx
- 【AI4Code】《Pythia: AI-assisted Code Completion System》(KDD 2019)
- Atcoder beginer contest 261 f / / tree array
- Chapter5 : Deep Learning and Computational Chemistry
- Any time, any place, super detective, seriously handle the case!
- The programmer's father made his own AI breast feeding detector to predict that the baby is hungry and not let the crying affect his wife's sleep
- Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
- 基于百问网IMX6ULL_PRO开发板驱动AP3216实验
猜你喜欢

【AI4Code】《Unified Pre-training for Program Understanding and Generation》 NAACL 2021

Shell common script: judge whether the file of the remote host exists

How to use causal inference and experiments to drive user growth| July 28 tf67

R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题

Mlx90640 infrared thermal imager temperature sensor module development notes (V)

Esp32-c3 is based on blinker lighting control 10 way switch or relay group under Arduino framework

工业互联网的内涵及其应用

B tree and b+ tree

Atcoder beginer contest 261e / / bitwise thinking + DP

好友让我看这段代码
随机推荐
【AI4Code】CodeX:《Evaluating Large Language Models Trained on Code》(OpenAI)
【OpenCV 例程 300篇】239. Harris 角点检测之精确定位(cornerSubPix)
Docekr learning - MySQL 8 master-slave replication setup deployment
Atcoder beginer contest 261 f / / tree array
微软提出CodeT:代码生成新SOTA,20个点的性能提升
工业互联网的内涵及其应用
基于百问网IMX6ULL_PRO开发板移植LCD多点触摸驱动(GT911)
TCP的拥塞控制
Convolutional neural network model -- vgg-16 network structure and code implementation
【AI4Code】《Pythia: AI-assisted Code Completion System》(KDD 2019)
Docker学习 - Redis集群-3主3从-扩容-缩容搭建
Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
央行数研所穆长春:数字人民币可控匿名是维护公众利益和金融安全的客观需要
【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)
Esp32-c3 is based on blinker lighting control 10 way switch or relay group under Arduino framework
R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
G027-OP-INS-RHEL-04 RedHat OpenStack 创建自定义的QCOW2格式镜像
Make a general cascade dictionary selection control based on jeecg -dictcascadeuniversal
[机器学习] 实验笔记 – 表情识别(emotion recognition)
Seven lines of code made station B crash for three hours, but "a scheming 0"