当前位置:网站首页>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
边栏推荐
- Excel import and export source code analysis
- 【AI4Code】CodeX:《Evaluating Large Language Models Trained on Code》(OpenAI)
- 二叉树基本知识
- Memory layout of program
- 程序员成长第二十七篇:如何评估需求优先级?
- [机器学习] 实验笔记 – 表情识别(emotion recognition)
- 0715RHCSA
- Handwriting a blog platform ~ first day
- Requirements specification template
- 【CSDN 年终总结】结束与开始,一直在路上—— “1+1=王”的2021总结
猜你喜欢

二叉树基本知识
![Detailed explanation of the training and prediction process of deep learning [taking lenet model and cifar10 data set as examples]](/img/70/2b5130be16d7699ef7db58d9065253.png)
Detailed explanation of the training and prediction process of deep learning [taking lenet model and cifar10 data set as examples]

Zero basic learning canoe panel (12) -- progress bar

Django 2 ----- 数据库与Admin

vim基础操作汇总

Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘

Numpy简介和特点(一)

B树和B+树
![[review SSM framework series] 15 - Summary of SSM series blog posts [SSM kill]](/img/fb/6ca8e0eb57c76c515e2aae68e9e549.png)
[review SSM framework series] 15 - Summary of SSM series blog posts [SSM kill]

7行代码让B站崩溃3小时,竟因“一个诡计多端的0”
随机推荐
Emqx cloud update: more parameters are added to log analysis, which makes monitoring, operation and maintenance easier
好友让我看这段代码
[operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
[six articles talk about scalablegnn] around www 2022 best paper PASCA
【GCN-CTR】DC-GNN: Decoupled GNN for Improving and Accelerating Large-Scale E-commerce Retrieval WWW22
一味地做大元宇宙的规模,已经背离了元宇宙本该有的发展逻辑
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
面试官问我:Mysql的存储引擎你了解多少?
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
Connotation and application of industrial Internet
[machine learning] experimental notes - emotion recognition
Shell常用脚本:检测某域名、IP地址是否通
R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
B tree and b+ tree
C#基础学习(二十三)_窗体与事件
Docker学习 - Redis集群-3主3从-扩容-缩容搭建
MySQL remote connection permission error 1045 problem
Convolutional neural network model -- vgg-16 network structure and code implementation