Java相关
tabyou
上穷碧落下黄泉, 两处茫茫皆不见
展开
-
Lombok注解
Lombok项目是一个Java库,它会自动插入您的编辑器和构建工具中,从而使您的Java更加生动有趣。永远不要再编写另一个getter或equals方法,带有一个注释的类将具有功能全面的生成器,自动执行日志记录变量等等。安装Lombok,maven项目添加以下内容到pom.xml.<dependencies> <dependency> <groupI...原创 2020-02-19 16:09:50 · 189 阅读 · 0 评论 -
springboot配置文件加密方案
背景springboot默认以fatjar形式打包,配置文件打在jar包里面的,支持将application配置外置,其他自定义配置文件可以通过设置做到外置,但是随之而来的就是配置文件敏感信息的安全问题,如果解决敏感信息的加密就是我们需要解决的问题。尝试解决调研是否存在现有的解决方案,大部分人推推荐jasypt https://github.com/jasypt/jasypt,尝试一下,的确...原创 2020-01-10 19:56:46 · 438 阅读 · 0 评论 -
中文乱码在java中URLEncoder.encode方法要调用两次解决
因为在jsp中对中文进行了编码的时候用的是UTF-8的编码方式,而在servlet中调用request.getParameter();方法的时候使用服务器指定的编码格式自动解码一次,所以前台编码一次后台解码一次而解码和编码的方式不用所以造成了乱码的出现,这就类似于以下代码: String name=java.net.URLEncoder.encode转载 2017-07-19 21:19:51 · 391 阅读 · 0 评论 -
Java的I/O出现中文乱码及默认编码问题
问题 项目中遇到再从aix系统移植到linux系统过程,项目导出报表文件出现乱码。启动脚本与原来一样,有下面的语句但并未生效LANG=ZH_CNexport LANG问题分析 从项目代码分析,代码中没有显示就行编码设置,于是导出文件的编码应该是系统默认编码,对于Java来说就是下面代码的值System.getProperty("file.encoding")其中fi原创 2017-07-18 23:19:03 · 619 阅读 · 0 评论 -
oracle实现分页数据重复
问题 做项目过程时,遇到hibernate实现分页功能中,在不同页面有存在重复数据。一开始以为是hibernate的问题,打开hibernate的show_sql=true开启,将生成的sql在plsql中执行复现了数据重复的问题。查阅资料得知,oracle在保证order by字段的排序外,相同order by字段的值不同记录之间排序顺序并不稳定。 比如表原创 2017-07-18 23:00:57 · 494 阅读 · 0 评论 -
欧拉计划 第10题
题目The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.计算两百万以下所有质数的和。10以下的质数的和是2 + 3 + 5 + 7 = 17.找出两百万以下所有质数的和。解答:Java程序public cla原创 2014-03-08 21:17:32 · 1051 阅读 · 0 评论 -
欧拉计划 第9题
题目A Pythagorean triplet is a set of three natural numbers, a b c, for which,For example, There exists exactly one Pythagorean triplet for which a + b + c = 1000.Find the product abc.找出唯一原创 2014-03-06 10:53:38 · 1091 阅读 · 0 评论 -
欧拉计划 第8题
题目Find the greatest product of five consecutive digits in the1000-digit number.找出这个1000位数字中连续5个数字乘积的最大值。找出以下这个1000位的整数中连续5个数字的最大乘积。(例如前五个数字的乘积是7*3*1*6*7=882)731671765313306249192251196744265原创 2014-03-05 14:47:57 · 1393 阅读 · 0 评论 -
欧拉计划 第7题
题目By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10 001st prime number?找出第10001个质数。前六个质数是2,3,5,7,11和13,其中第6个是13.第10001个质数是多原创 2014-03-05 14:37:48 · 901 阅读 · 0 评论 -
欧拉计划 第6题
题目The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)2 = 552 = 3025Hence the differ原创 2014-03-04 12:46:10 · 711 阅读 · 0 评论 -
欧拉计划 第5题
题目2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the numbers fr原创 2014-03-03 12:32:57 · 1150 阅读 · 0 评论 -
欧拉计划 第4题
题目A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.Find the largest palindrome made from the product of two原创 2014-03-02 16:15:46 · 900 阅读 · 0 评论 -
道路和航路 Java实现
问题描述农夫约翰正在针对一个新区域的牛奶配送合同进行研究。他打算分发牛奶到T个城镇(标号为1..T),这些城镇通过R条标号为(1..R)的道路和P条标号为(1..P)的航路相连。每一条公路i或者航路i表示成连接城镇Ai(1每一条公路都是双向的,正向和反向的花费是一样的,都是非负的。每一条航路都根据输入的Ai和Bi进行从Ai->Bi的单向通行。实际上,如果现在有一条航路是从Ai到Bi原创 2014-02-28 19:54:44 · 1274 阅读 · 4 评论 -
欧拉计划 第3题
题目The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?找出一个合数的最大质数因子13195的质数因子有5,7,13和29.600851475143的最大质数因子是多少?解答:这题要注意数据类型的范围(关于数据类原创 2014-03-01 14:37:09 · 1277 阅读 · 0 评论 -
欧拉计划 第2题
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...By considering原创 2014-03-01 14:13:35 · 1835 阅读 · 0 评论 -
欧拉计划 第1题
题目If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.找出1000以下原创 2014-02-28 20:57:38 · 810 阅读 · 0 评论