spring-boot Spring Boot 生成图片验证码 基本原理就是用Java画张指定大小的图片,在图片上随机摆上若干个数字或字母,数字或字母要有一定的倾斜和位移,要变一下字体和颜色,再画几条干扰线,然后就可以返回给客户端了。 创建文件 CaptchaUtil.java,代码如下: // Write your package import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import
fabric-java-sdk fabric-java-sdk中获取区块哈希 fabric-java-sdk 中没有 getBlockHash 这一方法,我们需要自己计算区块哈希,代码如下: String currentHash = Hex.encodeHexString(SDKUtils.calculateBlockHash(this.client, blockInfo.getBlockNumber(), blockInfo.getPreviousHash(), blockInfo.getDataHash()));
fabric-java-sdk fabric-java-sdk中blockInfo.getDataHash二进制转字符串 fabric-java-sdk中blockInfo.getDataHash二进制转字符串(byte[] 转 string),如下,使用 Hex.encodeHexString Hex.encodeHexString(blockInfo.getDataHash); Hex.encodeHexString(blockInfo.getPreviousHash);
spring-boot 在 spring-boot打包出来的 jar 包中中执行其它的main.class 需通过以下命令执行 java -cp your.jar -Dloader.main=your.package.Main org.springframework.boot.loader.PropertiesLauncher 如果直接执行 java -cp your.jar your.package.Main 会报错误: Error: Could not find or load main class ...
Java 如何比较Java两个Long对象相等 Long a = 30000L; Long b = 30000L; // 使用equals或者.longValue比较 a.equals(b); a.longValue() == b.longValue();
Java 【 LeetCode】79. Word Search 问题描述 https://leetcode.com/problems/word-search/#/description Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell,
Java 【LeetCode】78. Subsets 问题描述 Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1]
Java 【LeetCode】77. Combinations 问题描述 https://leetcode.com/problems/combinations/#/description Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a
Java 【LeetCode】75. Sort Colors 问题描述 https://leetcode.com/problems/sort-colors/#/description Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in
Java 【LeetCode】74. Search a 2D Matrix 问题描述 https://leetcode.com/problems/search-a-2d-matrix/#/description Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: * Integers in each row are
Java 【LeetCode】 73. Set Matrix Zeroes 问题描述 https://leetcode.com/problems/set-matrix-zeroes/#/description Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. 给定一个矩阵,如果一个元素为0,则其所在行和所在列都置为0.
Java 【LeetCode】72. Edit Distance 问题描述 https://leetcode.com/problems/edit-distance/#/description Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You
Java 【LeetCode】71. Simplify Path 问题描述 https://leetcode.com/problems/simplify-path/#/description Given an absolute path for a file (Unix-style), simplify it. For example path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" Corner Cases: * Did you consider the
Java 【LeetCode】69. Sqrt(x) 问题描述 https://leetcode.com/problems/sqrtx/#/description Implement int sqrt(int x). Compute and return the square root of x. 算法 使用折半查找即可,但要注意整型溢出 代码 public int mySqrt(int x) { int left = 1, right
Java 【LeetCode】68. Text Justification 问题描述 https://leetcode.com/problems/text-justification/#/description Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right)
Java 【LeetCode】64. Minimum Path Sum 问题描述 https://leetcode.com/problems/minimum-path-sum/#/description Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers
Java 【LeetCode】63. Unique Paths II 问题描述 https://leetcode.com/problems/unique-paths-ii/#/description Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty
Java 【LeetCode】62. Unique Paths 问题描述 https://leetcode.com/problems/unique-paths/#/description A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either
Java 【LeetCode】60. Permutation Sequence 问题描述 https://leetcode.com/problems/permutation-sequence/#/description he set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the
Java 【LeetCode】59. Spiral Matrix II 问题描述 https://leetcode.com/problems/spiral-matrix-ii/#/description Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. For example, Given n = 3, You should
Java 【LeetCode】57. Insert Interval 问题描述 https://leetcode.com/problems/insert-interval/#/description Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according
Java 【LeetCode】56. Merge Intervals 问题描述 https://leetcode.com/problems/merge-intervals/#/description Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,
Java 【LeetCode】55. Jump Game 问题描述 https://leetcode.com/problems/jump-game/#/description Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump
Java 【LeetCode】54. Spiral Matrix 问题描述 https://leetcode.com/problems/spiral-matrix/#/description Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following