当前位置:网站首页>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
边栏推荐
- 0713RHCSA
- 简单了解流
- Convolutional neural network model -- lenet network structure and code implementation
- 0720RHCSA
- R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
- R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
- VIM tip: always show line numbers
- The world is exploding, and the Google server has collapsed
- 【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)
- 好友让我看这段代码
猜你喜欢

录制和剪辑视频,如何解决占用空间过大的问题?

【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone

Common operations for Yum and VIM

Convolutional neural network model -- lenet network structure and code implementation

Generate SQL script file by initializing the latest warehousing time of vehicle attributes

Substance Designer 2021软件安装包下载及安装教程

【CTR】《Towards Universal Sequence Representation Learning for Recommender Systems》 (KDD‘22)

yum和vim须掌握的常用操作

基于百问网IMX6ULL_PRO开发板驱动AP3216实验

Date and time function of MySQL function summary
随机推荐
Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
Machine learning strong foundation program 0-4: popular understanding of Occam razor and no free lunch theorem
面试官问我:Mysql的存储引擎你了解多少?
基于百问网IMX6ULL_PRO开发板移植LCD多点触摸驱动(GT911)
错误: 找不到或无法加载主类 xxxx
迁移PaloAlto HA高可用防火墙到Panorama
0715RHCSA
Mu Changchun, data Research Institute of the central bank: controllable anonymity of digital RMB is an objective need to safeguard public interests and financial security
B树和B+树
MLIR原理与应用技术杂谈
Business visualization - make your flowchart'run'(3. Branch selection & cross language distributed operation node)
并发编程 — 内存模型 JMM
Redis可视化工具RDM安装包分享
【GCN-RS】Region or Global? A Principle for Negative Sampling in Graph-based Recommendation (TKDE‘22)
0717RHCSA
Generate SQL script file by initializing the latest warehousing time of vehicle attributes
How to use causal inference and experiments to drive user growth| July 28 tf67
Numpy简介和特点(一)
6W+字记录实验全过程 | 探索Alluxio经济化数据存储策略
卷积神经网络模型之——AlexNet网络结构与代码实现