当前位置:网站首页>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
边栏推荐
- [review SSM framework series] 15 - Summary of SSM series blog posts [SSM kill]
- B树和B+树
- Seven lines of code made station B crash for three hours, but "a scheming 0"
- 程序的内存布局
- 【GCN-RS】Towards Representation Alignment and Uniformity in Collaborative Filtering (KDD‘22)
- Excel import and export source code analysis
- Docker学习 - Redis集群-3主3从-扩容-缩容搭建
- Esp32-c3 is based on blinker lighting control 10 way switch or relay group under Arduino framework
- The world is exploding, and the Google server has collapsed
- 牛客论坛项目部署总结
猜你喜欢

【GCN-RS】Region or Global? A Principle for Negative Sampling in Graph-based Recommendation (TKDE‘22)

Zero basic learning canoe panel (13) -- trackbar

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

arm架构移植alsa-lib和alsa-utils一路畅通

Zero basic learning canoe panel (14) -- led control and LCD control

Seven lines of code made station B crash for three hours, but "a scheming 0"

Docker学习 - Redis集群-3主3从-扩容-缩容搭建
![[300 opencv routines] 239. accurate positioning of Harris corner detection (cornersubpix)](/img/a6/c45a504722f5fd6e3c9fb8e51c6bb5.png)
[300 opencv routines] 239. accurate positioning of Harris corner detection (cornersubpix)

卷积神经网络模型之——AlexNet网络结构与代码实现

Substance Designer 2021软件安装包下载及安装教程
随机推荐
EMQX Cloud 更新:日志分析增加更多参数,监控运维更省心
Shell common script: get the IP address of the network card
Machine learning strong foundation program 0-4: popular understanding of Occam razor and no free lunch theorem
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
Docker learning - redis cluster -3 master and 3 slave - capacity expansion - capacity reduction building
Emqx cloud update: more parameters are added to log analysis, which makes monitoring, operation and maintenance easier
Shell常用脚本:判断远程主机的文件是否存在
ESP32-C3 基于Arduino框架下Blinker点灯控制10路开关或继电器组
Masscode is an excellent open source code fragment manager
vim基础操作汇总
Atcoder beginer contest 261 f / / tree array
Shell common script: check whether a domain name and IP address are connected
Substance designer 2021 software installation package download and installation tutorial
【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)
【重温SSM框架系列】15 - SSM系列博文总结【SSM杀青篇】
AtCoder Beginner Contest 261 F // 树状数组
[operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
从输入网址到网页显示
机器学习强基计划0-4:通俗理解奥卡姆剃刀与没有免费午餐定理
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