![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程
Orange.P
这个作者很懒,什么都没留下…
展开
-
删除list中的元素
/** * 该方法虽然不报错,但会漏掉删除对象的下一个对象的判断 * @param list * @return */ private static List<Data> removefor1(List<Data> list){ for (int i=0; i<list.size(); i++){ Data cbd = list.ge...原创 2018-11-09 09:23:21 · 258 阅读 · 0 评论 -
idea下使用@Data注解
idea下使用@Data注解,调用对应实体的getset方法标红。需要下载lombok插件。 1. file--Settings--Plugins--搜索Lombok Plugin--install--重启idea 2. 对应的maven依赖: <dependency> <groupId>org.projectlombok</groupId> ...原创 2019-02-13 09:41:37 · 6204 阅读 · 1 评论 -
一个接口多个实现类,注入时需要指明是哪个实现类
@Autowired @Qualifier(value="testClientImpl") @Resource(name="testClientImpl") 两种方法都可以,value可以去掉。引号内的实现类名称首字母小写。原创 2019-02-27 15:37:19 · 539 阅读 · 0 评论 -
补位
System.out.println(String.format("%1$-5s","123")+"abc");//不足5位,后补空格 System.out.println(String.format("%08d", Integer.parseInt("1000")));//不足8位,前补0 如果数据本身已满足或超出长度,完整显示数据。 System.out.println(Strin...原创 2018-12-14 17:07:16 · 167 阅读 · 0 评论 -
Hex
1. 读取Hex文件 源文件【串:ASCII码(十六进制),数字:十六进制】: 43545449434450 ---- CTTICDP 00000000000011c4 ---- 00000000000011C4 04 ---- 4 AID NUM 41303030...原创 2018-11-09 12:30:09 · 424 阅读 · 0 评论 -
byte & ASCII & char
A. byte & char byte占1个字节,8位,最高位为符号位,代表正负。 范围:-128 ~ 127 二进制补码形式 1000 0000 ~ 0111 1111 char占2个字节,16位,无符号位。 范围:0 ~ 256 二进制补码形式 0000 0000 ~ 1111 1111 例:128 强转byte:-128;强转char,没有显示出来。应该是...原创 2018-11-09 12:12:23 · 381 阅读 · 0 评论 -
InputStream
1. FileInputStream byte占1个字节8位,范围:-128 ~ 127。 int占4个字节32位,范围:-2^31 ~ 2^31-1。 char占2个字节16位,范围:0~65536。 -27在内存中以补码形式存储,即:11100101。以int形式读取即为:229;强转char为乱码。 String str="好孩纸"; byte[] arr=str.getBytes()...原创 2018-11-09 11:35:55 · 108 阅读 · 0 评论 -
读取项目中放置的文件
1. 获取文件3.txt: A、相对路径:从src开始写起 //里面路径写成:3.txt报错:java.io.FileNotFoundException: 3.txt (系统找不到指定的文件。) FileInputStream in = new FileInputStream( "src\\3.txt"); B、绝对路径: String path = new File("").get...原创 2018-11-09 10:05:09 · 211 阅读 · 0 评论 -
throw Exception
public class ExceptionTest { public static void main(String[] args){ try{ throwException(); System.out.println("throw 后面");//此处不会打印 }catch (Exception e){ ...原创 2018-11-09 09:32:38 · 4988 阅读 · 0 评论