当前位置: 首页 > news >正文

荆州网站推广怎么做微信营销方法

荆州网站推广怎么做,微信营销方法,用护卫神做网站,淘宝网站建设违规吗常用API MATH 代表数学,是一个工具类,里面提供的都是对数据进行操作的一些静态方法。 方法名说明public static int abs(int a)获取参数绝对值public static double ceil(double a)向上取整public static double floor(double a)向下取整public stati…

常用API

MATH

代表数学,是一个工具类,里面提供的都是对数据进行操作的一些静态方法。

方法名说明
public static int abs(int a)获取参数绝对值
public static double ceil(double a)向上取整
public static double floor(double a)向下取整
public static int round(float a)四舍五入
public static int max(int a,int b)获取两个int值中的较大值
public static double pow(double a,double b)返回a的b次幂的值
public static double random()返回值为double的随机值,范围[0.0,1.0)
public static double sqrt(double a)返回a 的平方根
public static double cbrt(double a)返回a的立方根

System

System代表程序所在的系统,也是一个工具类。

System类提供的常见方法

方法名说明
public static void exit(int status)终止当前运行的Java虚拟机。
public static long currentTimeMillis()返回当前系统的时间毫秒值形式
  • 这里的毫秒值指的是从1970年1月1日 00:00:00走到此刻的总的毫秒数(1s = 1000ms)。

Runtime

代表程序运行所在的环境

Runtime类提供的常见方法

方法名说明
public static Runtime getRuntime()返回与当前Java应用程序关联的运行时对象
public void exit(int status)终止当前运行的虚拟机
public int availableProcessors()返回Java虚拟机可用的处理器数。
public long totalMemory()返回Java虚拟机中的内存总量
public long freeMemory()返回Java虚拟机中的可用内存
public Process exec(String command)启动某个程序,并返回代表该程序的对象

BigDecimal

public static void main(String[] args) {// 浮点型运算时, 直接+ - * / 可能会出现运算结果失真System.out.println(0.1 + 0.2);System.out.println(1.0 - 0.32);System.out.println(1.015 * 100);System.out.println(1.301 / 100);
}
image-20240410212956555
构造器说明
public BigDecimal(double val) 注意:不推荐使用这个,无法总精确运算将 double转换为BigDecimal
public BigDecimal(String val)把String转成BigDecimal
方法名说明
public static BigDecimal valueOf(double val)转换一个 double成 BigDecimal
public BigDecimal add(BigDecimal b)加法
public BigDecimal subtract(BigDecimal b)减法
public BigDecimal multiply(BigDecimal b)乘法
public BigDecimal divide(BigDecimal b)除法
public BigDecimal divide (另一个BigDecimal对象,精确几位,舍入模式)除法、可以控制精确到小数几位
public double doubleValue()将BigDecimal转换为double

JDK8之前传统的日期. 时间

Date

代表的是日期和时间。

构造器说明
public Date()创建一个Date对象,代表的是系统当前此刻日期时间。
public Date(long time)把时间毫秒值转换成Date日期对象。
常见方法说明
public long getTime()返回从1970年1月1日 00:00:00走到此刻的总的毫秒数
public void setTime(long time)设置日期对象的时间为当前时间毫秒值对应的时间

SimpleDateFormat

**SimpleDateFormat:**代表简单日期格式化,可以用来把日期对象、时间毫秒值格式化成我们想要的形式。

image-20240410215011046

SimpleDateFormat

常见构造器说明
public SimpleDateFormat(String pattern)创建简单日期格式化对象,并封装时间的格式
格式化时间的方法说明
public final String format(Date date)将日期格式化成日期/时间字符串
public final String format(Object time)将时间毫秒值式化成日期/时间字符串

时间格式的常见符号

image-20240410215306465

SimpleDateFormat解析字符串时间成为日期对象

解析方法说明
public Date parse(String source)把字符串时间解析成日期对象
  • SimpleDateFormat代表什么,有什么作用?
    • 简单日期格式化对象
    • 可以把日期对象及时间毫秒值格式化成我们想要的字符串形式。
    • 可以把字符串的时间形式解析成Date日期对象。
  • SimpleDateFormat的对象如何创建?
    • public SimpleDateFormat(String pattern)
  • SimpleDateFormat格式化,以及解析时间的方法是怎么样的?
    • public final String format(Date d):格式化日期对象
    • public final String format(Object time):格式化时间毫秒值
    • public Date parse(String source):解析字符串时间

Calendar

  • 代表的是系统此刻时间对应的日历。

  • 通过它可以单独获取、修改时间中的年、月、日、时、分、秒等。

  • 代表的是系统此刻时间对应的日历,通过它可以单独获取、修改时间中的年、月、日、时、分、秒等

方法名说明
public static Calendar getInstance()获取当前日历对象
public int get(int field)获取日历中的某个信息。
public final Date getTime()获取日期对象。
public long getTimeInMillis()获取时间毫秒值
public void set(int field,int value)修改日历的某个信息。
public void add(int field,int amount)为某个信息增加/减少指定的值

**注意:**calendar是可变对象,一旦修改后其对象本身表示的时间将产生变化。

JDK8开始新增的日期、时间

为什么要学JDK8新增的时间?

image-20240410215852306

JDK8新增的时间

LocalDate:年、月、日

LocalTime:时、分、秒

LocalDateTime:年、月、日、时、分、秒

ZoneId : 时区

ZonedDateTime:带时区的时间

DateTimeFormatter : :用于时间的格式化和解析

java.time包下的类 :

image-20240411081609859

LocalDate、LocalTime、LocalDateTime

LocalDate:代表本地日期(年、月、日、星期)
LocalTime:代表本地时间(时、分、秒、纳秒)
LocalDateTime:代表本地日期、时间(年、月、日、星期、时、分、秒、纳秒)

它们获取对象的方案

方法名示例
public static Xxxx now(): 获取系统当前时间对应的该对象LocaDate ld = LocalDate.now(); LocalTime lt = LocalTime.now(); LocalDateTime ldt = LocalDateTime.now();
public static Xxxx of(…):获取指定时间的对象LocalDate localDate1 = LocalDate.of(2099 , 11,11); LocalTime localTime1 = LocalTime.of(9, 8, 59); LocalDateTime localDateTime1 = LocalDateTime.of(2025, 11, 16, 14, 30, 01);

转换相关的API

image-20240411082209707

LocalDateTime的转换成LocalDate、LocalTime

方法名说明
public LocalDate toLocalDate()转换成一个LocalDate对象
public LocalTime toLocalTime()转换成一个LocalTime对象

LocalDate的常用API(都是处理年、月、日、星期相关的)。

方法名说明
public int geYear()获取年
public int getMonthValue()获取月份(1-12)
public int getDayOfMonth()获取日
public int getDayOfYear()获取当前是一年中的第几天
Public DayOfWeek getDayOfWeek()获取星期几:ld.getDayOfWeek().getValue()
方法名说明
withYear、withMonth、withDayOfMonth、withDayOfYear直接修改某个信息,返回新日期对象
plusYears、plusMonths、plusDays、plusWeeks把某个信息加多少,返回新日期对象
minusYears、minusMonths、minusDays,minusWeeks把某个信息减多少,返回新日期对象
equals isBefore isAfter判断两个日期对象,是否相等,在前还是在后

LocalTime的常用API (都是处理时、分、秒、纳秒相关的)。

方法名说明
public int getHour()获取小时
public int getMinute()获取分
public int getSecond()获取秒
public int getNano()获取纳秒
方法名说明
withHour、withMinute、withSecond、withNano修改时间,返回新时间对象
plusHours、plusMinutes、plusSeconds、plusNanos把某个信息加多少,返回新时间对象
minusHours、minusMinutes、minusSeconds、minusNanos把某个信息减多少,返回新时间对象
equals isBefore isAfter判断2个时间对象,是否相等,在前还是在后

LocalDateTime的常用API(可以处理年、月、日、星期、时、分、秒、纳秒等信息)

方法名说明
getYear、getMonthValue、getDayOfMonth、getDayOfYear getDayOfWeek、getHour、getMinute、getSecond、getNano获取年月日、时分秒、纳秒等
withYear、withMonth、withDayOfMonth、withDayOfYear withHour、withMinute、withSecond、withNano修改某个信息,返回新日期时间对象
plusYears、plusMonths、plusDays、plusWeeks plusHours、plusMinutes、plusSeconds、plusNanos把某个信息加多少,返回新日期时间对象
minusYears、minusMonths、minusDays、minusWeeks minusHours、minusMinutes、minusSeconds、minusNanos把某个信息减多少,返回新日期时间对象
equals isBefore isAfter判断2个时间对象,是否相等,在前还是在后

修改相关的API

  • LocalDateTime 综合了 LocalDate 和 LocalTime 里面的方法,所以下面只用 LocalDate 和 LocalTime 来举例。
  • 这些方法返回的是一个新的实例引用,因为LocalDateTime 、LocalDate 、LocalTime 都是不可变的。
方法名说明
plusDays, plusWeeks, plusMonths, plusYears向当前 LocalDate 对象添加几天、 几周、几个月、几年
minusDays, minusWeeks, minusMonths, minusYears从当前 LocalDate 对象减去几天、 几周、几个月、几年
withDayOfMonth, withDayOfYear, withMonth, withYear将月份天数、年份天数、月份、年 份 修 改 为 指 定 的 值 并 返 回 新 的 LocalDate 对象
isBefore, isAfter比较两个 LocalDate

Instant时间戳

image-20230507185019205

1、 Duration: 用于计算两个“时间”间隔。
2、 Period: 用于计算两个“日期”间隔。

ChronoUnit类可用于在单个时间单位内测量一段时间,这个工具类是最全的了,可以用于比较所有的时间单位

ZoneId、ZonedDateTime

  • ZoneId:代表时区Id
    • 中国标准时间: 世界标准时间(UTC) + 8小时

ZoneId 时区的常见方法

方法名说明
public static Set getAvailableZoneIds()获取Java中支持的所有时区
public static ZoneId systemDefault()获取系统默认时区
public static ZoneId of(String zoneId)获取一个指定时区

ZonedDateTime 带时区时间的常见方法

方法名说明
public static ZonedDateTime now()获取当前时区的ZonedDateTime对象
public static ZonedDateTime now(ZoneId zone)获取指定时区的ZonedDateTime对象
getYear、getMonthValue、getDayOfMonth、getDayOfYeargetDayOfWeek、getHour、getMinute、getSecond、getNano获取年月日、时分秒、纳秒等
public ZonedDateTime withXxx(时间)修改时间系列的方法
public ZonedDateTime minusXxx(时间)减少时间系列的方法
public ZonedDateTime plusXxx(时间)增加时间系列的方法

DateTimeFormatter

方法名说明
public static DateTimeFormatter ofPattern(时间格式)获取格式化器对象

LocalDateTime提供的格式化、解析时间的方法

方法名说明
public String format(DateTimeFormatter formatter)格式化时间
public static LocalDateTime parse(CharSequence text,DateTimeFormatter formatter)解析时间

Arrays

用来操作数组的一个工具类。

Arrays类提供的的常见方法

方法名说明
public static String toString(类型[] arr)返回数组的内容(字符串形式)
public static int[] copyOfRange(类型[] arr, 起始索引, 结束索引)拷贝数组(指定范围)
public static 类型 copyOf(类型[] arr, int newLength)拷贝数组
public static void setAll(double[] array, IntToDoubleFunction generator)把数组中的原数据改为新数据
public static void sort(类型[] arr)对数组进行排序(默认是升序排序)
public static void sort(类型[] a, Comparator<? super T> c)使用比较器对象自定义排序
public static int binarySearch(int[] a, int key)二分搜索数组中的数据,存在返回索引,不存在返回-1

对数组中的数据进行排序

double[] prices = {99.8, 128, 100};

Arrays.*sort*(prices);

System.out.println(Arrays.toString(prices));

99.8, 100.0, 128.0

如果数组中存储的是对象, 如何排序?

Student[] students = new Student[4];
students[0] = new Student("蜘蛛精", 169.5, 23);students[1] = new Student("紫霞", 163.8, 26);students[2] = new Student("紫霞", 163.8, 26);students[3] = new Student("至尊宝", 167.5, 24);
  • 方式一:
    • 自然排序:让该对象的类实现Comparable(比较规则)接口,重写compareTo方法,制定比较规则
  • 方式二:
    • 比较器排序:使用下面这个sort方法,创建Comparator比较器接口的匿名内部类对象,制定比较规则
public static void sort(T[] arr, Comparator<? super T> c)对数组进行排序(支持自定义排序规则)

自定义排序规则时,需要遵循的官方约定如下:

  • 设置Comparator接口对应的比较器对象,来定制比较规则

    • 左边对象大于右边对象,返回正整数;

    • 左边对象小于右边对象,返回负整数;

    • 两边对象相等,返回0 这样就可以得到升序


文章转载自:
http://herculean.jqLx.cn
http://burlap.jqLx.cn
http://alumnae.jqLx.cn
http://estranged.jqLx.cn
http://intrapersonal.jqLx.cn
http://expeditionary.jqLx.cn
http://kilt.jqLx.cn
http://hoe.jqLx.cn
http://monumentalize.jqLx.cn
http://reconsignment.jqLx.cn
http://write.jqLx.cn
http://salesite.jqLx.cn
http://refining.jqLx.cn
http://terbium.jqLx.cn
http://sewing.jqLx.cn
http://rune.jqLx.cn
http://clotheshorse.jqLx.cn
http://darkadapted.jqLx.cn
http://videlicet.jqLx.cn
http://purline.jqLx.cn
http://cognate.jqLx.cn
http://newsletter.jqLx.cn
http://shamefast.jqLx.cn
http://photosetting.jqLx.cn
http://luluai.jqLx.cn
http://subarachnoid.jqLx.cn
http://whump.jqLx.cn
http://drivepipe.jqLx.cn
http://dihydroxyacetone.jqLx.cn
http://satrangi.jqLx.cn
http://kludge.jqLx.cn
http://macrophyllous.jqLx.cn
http://slantingwise.jqLx.cn
http://guangdong.jqLx.cn
http://coarseness.jqLx.cn
http://tenty.jqLx.cn
http://snowslip.jqLx.cn
http://kata.jqLx.cn
http://siliceous.jqLx.cn
http://undergone.jqLx.cn
http://anabolic.jqLx.cn
http://issa.jqLx.cn
http://tricklet.jqLx.cn
http://phosphorescence.jqLx.cn
http://unsuccessful.jqLx.cn
http://psychologically.jqLx.cn
http://revokable.jqLx.cn
http://revivify.jqLx.cn
http://tokology.jqLx.cn
http://calces.jqLx.cn
http://alternately.jqLx.cn
http://prizewinner.jqLx.cn
http://monography.jqLx.cn
http://presidio.jqLx.cn
http://quaverous.jqLx.cn
http://copesmate.jqLx.cn
http://interiorly.jqLx.cn
http://ergodic.jqLx.cn
http://squirm.jqLx.cn
http://seeper.jqLx.cn
http://absurdness.jqLx.cn
http://first.jqLx.cn
http://rhenish.jqLx.cn
http://ephesus.jqLx.cn
http://remonstrant.jqLx.cn
http://phonograph.jqLx.cn
http://psyche.jqLx.cn
http://erotophobic.jqLx.cn
http://fascicle.jqLx.cn
http://sarvodaya.jqLx.cn
http://microcyte.jqLx.cn
http://dislike.jqLx.cn
http://alphabetize.jqLx.cn
http://bubbly.jqLx.cn
http://becoming.jqLx.cn
http://allness.jqLx.cn
http://boreen.jqLx.cn
http://canoeing.jqLx.cn
http://asseveration.jqLx.cn
http://extrinsical.jqLx.cn
http://lingberry.jqLx.cn
http://restorable.jqLx.cn
http://antibiosis.jqLx.cn
http://prudhoe.jqLx.cn
http://chirography.jqLx.cn
http://chirogymnast.jqLx.cn
http://hinder.jqLx.cn
http://actualise.jqLx.cn
http://circuity.jqLx.cn
http://typhlosis.jqLx.cn
http://cornu.jqLx.cn
http://gambade.jqLx.cn
http://needlestone.jqLx.cn
http://sicklemia.jqLx.cn
http://pignorate.jqLx.cn
http://nanhai.jqLx.cn
http://bersagliere.jqLx.cn
http://negativist.jqLx.cn
http://hypogeusia.jqLx.cn
http://courtezan.jqLx.cn
http://www.hrbkazy.com/news/73312.html

相关文章:

  • 永州做网站的公司网络广告创意
  • 广东快速做网站公司哪家好seo专员是什么
  • 四川省建设部网站企业品牌推广方案
  • 做测试日本网站成人短期培训学校
  • 可做兼职的翻译网站有哪些百度网盘官方下载
  • 网站页面结构深圳seo优化公司搜索引擎优化方案
  • 怎么给网站做搜索功能如何快速推广自己的网站
  • wordpress 评论ip拉黑网络快速排名优化方法
  • 义乌个人兼职做建设网站营销型网站建设要点
  • dwcc如何做网站百度榜
  • 番禺人才网车床工铣床工招聘整站优化快速排名
  • 2017优惠券网站怎么做外呼系统电销
  • 山东济宁曲阜疫情最新情况windows优化大师可靠吗
  • 做外单阿里的网站seo搜索引擎优化怎么优化
  • 八年级信技做网站品牌推广包括哪些内容
  • 东莞城建局官网google搜索优化
  • iis6.0建立网站深圳搜索竞价账户托管
  • 2免费做网站友情链接方面
  • 上海网站公司排名在线网络培训平台
  • 德州东海建设集团网站深圳网站建设开发公司
  • 世界500强企业排名(2022最新名单)做seo网页价格
  • 如何做网站banner河北网络推广技术
  • 新疆建设厅网站官网天门网站建设
  • 怎么用wix做网站南宁关键词优化公司
  • 深圳做网站的好公司软件外包网
  • 企业网站 手机站站内推广的方法
  • 简述网站制作的流程高端网站建设报价
  • 陕西的建设厅官方网站上海百度推广官方电话
  • 北京企业网站建站哪家好推广游戏赚钱的平台有哪些
  • 郑州网站建设哪家好如何推广外贸型网站