- 博客(30)
- 资源 (3)
- 问答 (5)
- 收藏
- 关注
原创 java 无向图 ,支持删除与新增节点
备注:遍历顶点合集时,使用原生的方法可能存在下标错位的情况,使用时用迭代器遍历即可。package exercise.data.structure.graph;import java.util.ArrayList;import java.util.Arrays;import java.util.List;/*** 无向图* @Author quanfa.liu* @Date 2021年12月11日 上午9:13:08* @Version 1.0*/public clas...
2021-12-11 11:32:41
574
原创 java 二叉树
public class BinaryTreeNode<T> { String key; T value; BinaryTreeNode<T> left; BinaryTreeNode<T> right; BinaryTreeNode() { } public BinaryTreeNode(T value, String key) { this.value = value; th...
2021-06-21 15:10:12
141
原创 java 通用树结构
String key;//节点key T value;//节点数据 TreeNode<T>[] subNode;//当前节点子节点集 private static final int LEN = 5;//默认子集长度 public TreeNode(T value, String key) { new TreeNode<T>(value,key,LEN); } @SuppressWarnings("unchecked"...
2021-06-21 11:30:53
236
原创 java通过反射给实体属性赋值
public static <T> T init(T t, Object val) { Object value; Method method; StringBuffer sb; String fieldname; Class<? extends Object> clz = t.getClass(); Field[] fields = clz.getDeclaredFields();...
2020-07-27 16:39:31
432
原创 nginx 1.6 反向代理配置,亲测可用
user root;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}http { include mime.types; default_...
2020-07-20 10:57:03
266
原创 better-scroller实现上下拉刷新
基于bettor-scroll实现页面上下拉刷新,效果完美。注意: 1.每次处理完数据列表时,需要重新计算页面刷新区高度,确保正常:scroll.refresh() 2.使用scroll.hasVerticalScroll = true 手动设置是否可以上下拉刷新/* 列表容器 */.list-wrapper { position: fixed; z-index: 1; top: 2.2rem; bottom: 50px; ...
2020-07-20 10:29:26
390
原创 jsch 跨主机上传文件(fstp)
/** import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; * @throws Exception */ public static void main(String[] args) throws Excepti...
2020-05-12 17:06:07
363
原创 合并多张图片为pdf
/*** * 利用itext把多张图片组合为pdf * @Param pdfFilePath 生成的pdf保存路径 * @Param imgFilePath 图片路基list */ public void createPdf(String pdfFilePath, String... imgFilePath) throws IOException { // 创建pdf文件 Document document = new...
2020-05-12 16:51:15
250
原创 向图片中打印一行文本
//import javax.imageio.ImageIO; public static void main(String[] args) throws IOException { BufferedImage a = ImageIO.read(new File("图片路径1"));//读取图片1 Graphics2D g = a.createGraphics();//用a创建绘画对象 int w = a.getWidth(); ...
2020-05-12 16:44:07
114
原创 将一张图片填充到另一张图片上
//import javax.imageio.ImageIO; public static void main(String[] args) throws IOException { BufferedImage a = ImageIO.read(new File("图片路径1"));//读取图片1 BufferedImage b = ImageIO.read(new File("图片路径2"));//读取图片2 Graphics2D gd = ...
2020-05-12 16:36:39
719
原创 bettrt-scroller实现上下拉刷新,支持页面过长第一次下滑到底部不刷新
<html lang="en"> <head> 引入2个js </head> <div class="sort-right-main"> <div class="sort-title-box"> <div class="sort-title" id="bus_type">demo</div> ...
2020-05-12 11:46:10
211
原创 文本过长显示为3个点
#demo{ height: 2.5rem; width: 10rem; background: orange; color: #000000; line-height: 2.5rem; text-overflow: ellipsis; ...
2020-05-12 10:55:31
444
原创 base64码生成图片
public static boolean GenerateImage(String imgStr, String imgFilePath) { byte[] bytes = null; try { BASE64Decoder decoder = new BASE64Decoder(); int j = imgStr.indexOf(','); if (j != -1) { ...
2020-05-12 10:49:08
363
原创 itext向现有pdf新增空白页并追加图片
public boolean addImgToPdf() throws Exception { boolean result = false; PdfReader reader = null; PdfStamper stamper = null; FileInputStream fis = null; try { fis = new FileInputStream(new File("原pdf路径1")...
2020-05-12 10:45:08
3419
原创 js 实现手机端任意拖拽悬浮窗,在手机屏幕范围任意移动,始终居右显示
1.css:#demo{border-radius: 1rem;position: fixed;height: 1rem;width: 1rem;right: 0;z-index: 999999;bottom: .35rem;text-align: center;font-size: 0;}2.页面:3.js代码:function initDialog(){let ...
2019-08-02 11:35:00
1622
原创 java生成二维码,全过程,不要积分
1.首先,Java类中引入4个jar包import com.google.zxing.BarcodeFormat;import com.google.zxing.EncodeHintType;import com.google.zxing.MultiFormatWriter;import com.google.zxing.common.BitMatrix;2.然后撸代码public S...
2019-04-30 16:05:48
266
原创 Java输出某一个字符串中重复出现的字串(长度为2)及其出现的次数
public static void test3() {String str = “adfadgad”;List list = new ArrayList<>();for (int i = 0; i < str.length(); i++) {if ((i + 1) < str.length()) {String temp = str.charAt(i) + “”...
2019-04-02 10:00:52
1168
原创 Java保留两位小数
double num = 494123.558578923; public void m1() { BigDecimal bg = new BigDecimal(num); double a = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); S...
2018-12-24 16:47:33
180
原创 java Map 遍历效率
public static void main(String[] args) { Map<Object, Object> map = new HashMap<Object, Object>(); for (int i = 0, j = 10000 << 10; i < j; i++) { map.pu...
2018-12-21 15:15:16
367
原创 Java 判断对象为空工具类
方法没有涵盖所有Java类型 //空 private static boolean isempty(Object o) { boolean res = false; if (o == null) { return true; } Class clz = o.getClass(); ...
2018-12-20 17:40:36
1934
原创 dom4j解析本地xml
/** * SAX(simple API for * XML)是一种XML解析的替代方法。相比于DOM,SAX是一种速度更快,更有效的方法。它逐行扫描文档,一边扫描一边解析 * 。而且相比于DOM,SAX可以在解析文档的任意时刻停止解析,但任何事物都有其相反的一面,对于SAX来说就是操作复杂 * * 将xml解析为树结构,通过自定义命名的根节点遍...
2018-12-20 11:14:03
288
原创 POI操作本地excel
private static final String EXCEL_XLS = "xls"; private static final String EXCEL_XLSX = "xlsx"; /** * 判断文件是否是excel * * @throws Exception */ public static void checkEx...
2018-12-20 09:15:33
303
原创 Java 枚举
private enum SEX { MAN("1", "男"), FEMAN("0", "女"); private String code; private String value; public String getValue() { return value; } ...
2018-12-17 15:42:14
134
原创 拆半插入(二分法插入)——BinarySort
package sort.com;public class BinarySort { /** * 程序入口方法 * 拆半插入(二分法拆入)相当于将原来的数据序列从中间一分为二,利用中间的索引 * 改变左右序列的索引值,一直进行到找到合适的插入位置 */ public static void...
2018-12-17 11:30:25
794
原创 优化的选择排序——SelectionSortSecond
package sort.com;public class SelectionSortSecond { /** *优化的选择排序,减少了交换次数 * */public static void main(String[] args) { int []a = {5,-7,0,12,63,23,12,-6,1,-25}; for (int i=
2016-12-26 12:31:52
328
原创 选择排序——SelectionSortFirst
package sort.com;public class SelectionSortFirst { /** * 程序入口方法 * */public static void main(String[] args) { //定义数组 int [] a = {7,-1,6,16,25,-30,0,4,10}; for (int i = 0; i < a.length
2016-12-26 12:21:55
199
原创 希尔排序——ShellSort
package sort.com; public class ShellSortFirst { /** * 程序入口方法 */ public static void main(String[] args) { int []a={12,6,9,63,-22,0,96,1,7}; // 计算出h的最大值 int h=1;
2016-12-22 20:10:43
281
原创 拆半插入——BinarySort
package sort.com; public class BinarySort { /** * 程序入口方法 * 拆半插入(二分法拆入)相当于将原来的数据序列从中间一分为二,利用中间的索引 * 改变左右序列的索引值,一直进行到找到合适的插入位置 */public static void main(String[
2016-12-22 18:21:18
1137
原创 直接插入——InsertSort
package sort.com; import java.util.*; public class InsertSort { /** * 程序入口方法 * */ public static void main(String[] args) { //Arrays.sort(a);数组自动排序 //用数组机制
2016-12-22 15:27:19
281
tomcat自挂掉,想问下啥原因
2022-02-11
tomcat处理异步http请求过程求解
2021-10-23
java 实现自己的简易数据库
2021-08-03
itext 合并pdf 后签字域丢失,救我
2021-07-05
根据长度为n的数组生成n层深度的数据结构
2021-04-26
TA创建的收藏夹 TA关注的收藏夹
TA关注的人