- 浏览: 753189 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
lgh1992314:
a offset: 26b offset: 24c offse ...
java jvm字节占用空间分析 -
ls0609:
语音实现在线听书http://blog.csdn.net/ls ...
Android 语音输入API使用 -
wangli61289:
http://viralpatel-net-tutorials ...
Android 语音输入API使用 -
zxjlwt:
学习了素人派http://surenpi.com
velocity宏加载顺序 -
tt5753:
谢啦........
Lucene的IndexWriter初始化时的LockObtainFailedException的解决方法
在com.sun.imageio.plugins.bmp包中的BMPImageReader类中
public void readHeader() throws IOException { if (gotHeader) return; if (iis == null) { throw new IllegalStateException("Input source not set!"); } int profileData = 0, profileSize = 0; this.metadata = new BMPMetadata(); iis.mark(); // read and check the magic marker byte[] marker = new byte[2]; iis.read(marker); if (marker[0] != 0x42 || marker[1] != 0x4d) throw new IllegalArgumentException(I18N.getString("BMPImageReader1")); // Read file size bitmapFileSize = iis.readUnsignedInt(); // skip the two reserved fields iis.skipBytes(4); // Offset to the bitmap from the beginning bitmapOffset = iis.readUnsignedInt(); // End File Header // Start BitmapCoreHeader long size = iis.readUnsignedInt(); if (size == 12) { width = iis.readShort(); height = iis.readShort(); } else { width = iis.readInt(); height = iis.readInt(); } metadata.width = width; metadata.height = height; int planes = iis.readUnsignedShort(); bitsPerPixel = iis.readUnsignedShort(); //metadata.colorPlane = planes; metadata.bitsPerPixel = (short)bitsPerPixel; // As BMP always has 3 rgb bands, except for Version 5, // which is bgra numBands = 3; if (size == 12) { // Windows 2.x and OS/2 1.x metadata.bmpVersion = VERSION_2; // Classify the image type if (bitsPerPixel == 1) { imageType = VERSION_2_1_BIT; } else if (bitsPerPixel == 4) { imageType = VERSION_2_4_BIT; } else if (bitsPerPixel == 8) { imageType = VERSION_2_8_BIT; } else if (bitsPerPixel == 24) { imageType = VERSION_2_24_BIT; } // Read in the palette int numberOfEntries = (int)((bitmapOffset - 14 - size) / 3); int sizeOfPalette = numberOfEntries*3; palette = new byte[sizeOfPalette]; iis.readFully(palette, 0, sizeOfPalette); metadata.palette = palette; metadata.paletteSize = numberOfEntries; } else { compression = iis.readUnsignedInt(); imageSize = iis.readUnsignedInt(); long xPelsPerMeter = iis.readInt(); long yPelsPerMeter = iis.readInt(); long colorsUsed = iis.readUnsignedInt(); long colorsImportant = iis.readUnsignedInt(); metadata.compression = (int)compression; metadata.xPixelsPerMeter = (int)xPelsPerMeter; metadata.yPixelsPerMeter = (int)yPelsPerMeter; metadata.colorsUsed = (int)colorsUsed; metadata.colorsImportant = (int)colorsImportant; if (size == 40) { // Windows 3.x and Windows NT switch((int)compression) { case BI_JPEG: case BI_PNG: metadata.bmpVersion = VERSION_3; imageType = VERSION_3_XP_EMBEDDED; break; case BI_RGB: // No compression case BI_RLE8: // 8-bit RLE compression case BI_RLE4: // 4-bit RLE compression // Read in the palette int numberOfEntries = (int)((bitmapOffset-14-size) / 4); int sizeOfPalette = numberOfEntries * 4; palette = new byte[sizeOfPalette]; iis.readFully(palette, 0, sizeOfPalette); metadata.palette = palette; metadata.paletteSize = numberOfEntries; if (bitsPerPixel == 1) { imageType = VERSION_3_1_BIT; } else if (bitsPerPixel == 4) { imageType = VERSION_3_4_BIT; } else if (bitsPerPixel == 8) { imageType = VERSION_3_8_BIT; } else if (bitsPerPixel == 24) { imageType = VERSION_3_24_BIT; } else if (bitsPerPixel == 16) { imageType = VERSION_3_NT_16_BIT; redMask = 0x7C00; greenMask = 0x3E0; blueMask = (1 << 5) - 1;// 0x1F; metadata.redMask = redMask; metadata.greenMask = greenMask; metadata.blueMask = blueMask; } else if (bitsPerPixel == 32) { imageType = VERSION_3_NT_32_BIT; redMask = 0x00FF0000; greenMask = 0x0000FF00; blueMask = 0x000000FF; metadata.redMask = redMask; metadata.greenMask = greenMask; metadata.blueMask = blueMask; } metadata.bmpVersion = VERSION_3; break; case BI_BITFIELDS: if (bitsPerPixel == 16) { imageType = VERSION_3_NT_16_BIT; } else if (bitsPerPixel == 32) { imageType = VERSION_3_NT_32_BIT; } // BitsField encoding redMask = (int)iis.readUnsignedInt(); greenMask = (int)iis.readUnsignedInt(); blueMask = (int)iis.readUnsignedInt(); metadata.redMask = redMask; metadata.greenMask = greenMask; metadata.blueMask = blueMask; if (colorsUsed != 0) { // there is a palette sizeOfPalette = (int)colorsUsed*4; palette = new byte[sizeOfPalette]; iis.readFully(palette, 0, sizeOfPalette); metadata.palette = palette; metadata.paletteSize = (int)colorsUsed; } metadata.bmpVersion = VERSION_3_NT; break; default: throw new RuntimeException(I18N.getString("BMPImageReader2")); } } else if (size == 108 || size == 124) { // Windows 4.x BMP if (size == 108) metadata.bmpVersion = VERSION_4; else if (size == 124) metadata.bmpVersion = VERSION_5; // rgb masks, valid only if comp is BI_BITFIELDS redMask = (int)iis.readUnsignedInt(); greenMask = (int)iis.readUnsignedInt(); blueMask = (int)iis.readUnsignedInt(); // Only supported for 32bpp BI_RGB argb alphaMask = (int)iis.readUnsignedInt(); long csType = iis.readUnsignedInt(); int redX = iis.readInt(); int redY = iis.readInt(); int redZ = iis.readInt(); int greenX = iis.readInt(); int greenY = iis.readInt(); int greenZ = iis.readInt(); int blueX = iis.readInt(); int blueY = iis.readInt(); int blueZ = iis.readInt(); long gammaRed = iis.readUnsignedInt(); long gammaGreen = iis.readUnsignedInt(); long gammaBlue = iis.readUnsignedInt(); if (size == 124) { metadata.intent = iis.readInt(); profileData = iis.readInt(); profileSize = iis.readInt(); iis.skipBytes(4); } metadata.colorSpace = (int)csType; if (csType == LCS_CALIBRATED_RGB) { // All the new fields are valid only for this case metadata.redX = redX; metadata.redY = redY; metadata.redZ = redZ; metadata.greenX = greenX; metadata.greenY = greenY; metadata.greenZ = greenZ; metadata.blueX = blueX; metadata.blueY = blueY; metadata.blueZ = blueZ; metadata.gammaRed = (int)gammaRed; metadata.gammaGreen = (int)gammaGreen; metadata.gammaBlue = (int)gammaBlue; } // Read in the palette int numberOfEntries = (int)((bitmapOffset-14-size) / 4); int sizeOfPalette = numberOfEntries*4; palette = new byte[sizeOfPalette]; iis.readFully(palette, 0, sizeOfPalette); metadata.palette = palette; metadata.paletteSize = numberOfEntries; switch ((int)compression) { case BI_JPEG: case BI_PNG: if (size == 108) { imageType = VERSION_4_XP_EMBEDDED; } else if (size == 124) { imageType = VERSION_5_XP_EMBEDDED; } break; default: if (bitsPerPixel == 1) { imageType = VERSION_4_1_BIT; } else if (bitsPerPixel == 4) { imageType = VERSION_4_4_BIT; } else if (bitsPerPixel == 8) { imageType = VERSION_4_8_BIT; } else if (bitsPerPixel == 16) { imageType = VERSION_4_16_BIT; if ((int)compression == BI_RGB) { redMask = 0x7C00; greenMask = 0x3E0; blueMask = 0x1F; } } else if (bitsPerPixel == 24) { imageType = VERSION_4_24_BIT; } else if (bitsPerPixel == 32) { imageType = VERSION_4_32_BIT; if ((int)compression == BI_RGB) { redMask = 0x00FF0000; greenMask = 0x0000FF00; blueMask = 0x000000FF; } } metadata.redMask = redMask; metadata.greenMask = greenMask; metadata.blueMask = blueMask; metadata.alphaMask = alphaMask; } } else { throw new RuntimeException(I18N.getString("BMPImageReader3")); } } if (height > 0) { // bottom up image isBottomUp = true; } else { // top down image isBottomUp = false; height = Math.abs(height); } // Reset Image Layout so there's only one tile. //Define the color space ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); if (metadata.colorSpace == PROFILE_LINKED || metadata.colorSpace == PROFILE_EMBEDDED) { iis.mark(); iis.skipBytes(profileData - size); byte[] profile = new byte[profileSize]; iis.readFully(profile, 0, profileSize); iis.reset(); try { if (metadata.colorSpace == PROFILE_LINKED) colorSpace = new ICC_ColorSpace(ICC_Profile.getInstance(new String(profile))); else colorSpace = new ICC_ColorSpace(ICC_Profile.getInstance(profile)); } catch (Exception e) { colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); } } if (bitsPerPixel == 0 || compression == BI_JPEG || compression == BI_PNG ) { // the colorModel and sampleModel will be initialzed // by the reader of embedded image colorModel = null; sampleModel = null; } else if (bitsPerPixel == 1 || bitsPerPixel == 4 || bitsPerPixel == 8) { // When number of bitsPerPixel is <= 8, we use IndexColorModel. numBands = 1; if (bitsPerPixel == 8) { int[] bandOffsets = new int[numBands]; for (int i = 0; i < numBands; i++) { bandOffsets[i] = numBands -1 -i; } sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, width, height, numBands, numBands * width, bandOffsets); } else { // 1 and 4 bit pixels can be stored in a packed format. sampleModel = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, bitsPerPixel); } // Create IndexColorModel from the palette. byte r[], g[], b[]; if (imageType == VERSION_2_1_BIT || imageType == VERSION_2_4_BIT || imageType == VERSION_2_8_BIT) { size = palette.length/3; if (size > 256) { size = 256; } int off; r = new byte[(int)size]; g = new byte[(int)size]; b = new byte[(int)size]; for (int i=0; i<(int)size; i++) { off = 3 * i; b[i] = palette[off]; g[i] = palette[off+1]; r[i] = palette[off+2]; } } else { size = palette.length/4; if (size > 256) { size = 256; } int off; r = new byte[(int)size]; g = new byte[(int)size]; b = new byte[(int)size]; for (int i=0; i<size; i++) { off = 4 * i; b[i] = palette[off]; g[i] = palette[off+1]; r[i] = palette[off+2]; } } if (ImageUtil.isIndicesForGrayscale(r, g, b)) colorModel = ImageUtil.createColorModel(null, sampleModel); else colorModel = new IndexColorModel(bitsPerPixel, (int)size, r, g, b); } else if (bitsPerPixel == 16) { numBands = 3; sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_USHORT, width, height, new int[] {redMask, greenMask, blueMask}); colorModel = new DirectColorModel(colorSpace, 16, redMask, greenMask, blueMask, 0, false, DataBuffer.TYPE_USHORT); } else if (bitsPerPixel == 32) { numBands = alphaMask == 0 ? 3 : 4; // The number of bands in the SampleModel is determined by // the length of the mask array passed in. int[] bitMasks = numBands == 3 ? new int[] {redMask, greenMask, blueMask} : new int[] {redMask, greenMask, blueMask, alphaMask}; sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, width, height, bitMasks); colorModel = new DirectColorModel(colorSpace, 32, redMask, greenMask, blueMask, alphaMask, false, DataBuffer.TYPE_INT); } else { numBands = 3; // Create SampleModel int[] bandOffsets = new int[numBands]; for (int i = 0; i < numBands; i++) { bandOffsets[i] = numBands -1 -i; } sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, width, height, numBands, numBands * width, bandOffsets); colorModel = ImageUtil.createColorModel(colorSpace, sampleModel); } originalSampleModel = sampleModel; originalColorModel = colorModel; // Reset to the start of bitmap; then jump to the //start of image data iis.reset(); iis.skipBytes(bitmapOffset); gotHeader = true; } public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { if (iis == null) { throw new IllegalStateException(I18N.getString("BMPImageReader5")); } checkIndex(imageIndex); clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); //read header readHeader(); sourceRegion = new Rectangle(0, 0, 0, 0); destinationRegion = new Rectangle(0, 0, 0, 0); computeRegions(param, this.width, this.height, param.getDestination(), sourceRegion, destinationRegion); scaleX = param.getSourceXSubsampling(); scaleY = param.getSourceYSubsampling(); // If the destination band is set used it sourceBands = param.getSourceBands(); destBands = param.getDestinationBands(); seleBand = (sourceBands != null) && (destBands != null); noTransform = destinationRegion.equals(new Rectangle(0, 0, width, height)) || seleBand; if (!seleBand) { sourceBands = new int[numBands]; destBands = new int[numBands]; for (int i = 0; i < numBands; i++) destBands[i] = sourceBands[i] = i; } // If the destination is provided, then use it. Otherwise, create new one bi = param.getDestination(); // Get the image data. WritableRaster raster = null; if (bi == null) { if (sampleModel != null && colorModel != null) { sampleModel = sampleModel.createCompatibleSampleModel(destinationRegion.x + destinationRegion.width, destinationRegion.y + destinationRegion.height); if (seleBand) sampleModel = sampleModel.createSubsetSampleModel(sourceBands); raster = Raster.createWritableRaster(sampleModel, new Point()); bi = new BufferedImage(colorModel, raster, false, null); } } else { raster = bi.getWritableTile(0, 0); sampleModel = bi.getSampleModel(); colorModel = bi.getColorModel(); noTransform &= destinationRegion.equals(raster.getBounds()); } byte bdata[] = null; // buffer for byte data short sdata[] = null; // buffer for short data int idata[] = null; // buffer for int data // the sampleModel can be null in case of embedded image if (sampleModel != null) { if (sampleModel.getDataType() == DataBuffer.TYPE_BYTE) bdata = (byte[]) ((DataBufferByte)raster.getDataBuffer()).getData(); else if (sampleModel.getDataType() == DataBuffer.TYPE_USHORT) sdata = (short[]) ((DataBufferUShort)raster.getDataBuffer()).getData(); else if (sampleModel.getDataType() == DataBuffer.TYPE_INT) idata = (int[]) ((DataBufferInt)raster.getDataBuffer()).getData(); } // There should only be one tile. switch(imageType) { case VERSION_2_1_BIT: // no compression read1Bit(bdata); break; case VERSION_2_4_BIT: // no compression read4Bit(bdata); break; case VERSION_2_8_BIT: // no compression read8Bit(bdata); break; case VERSION_2_24_BIT: // no compression read24Bit(bdata); break; case VERSION_3_1_BIT: // 1-bit images cannot be compressed. read1Bit(bdata); break; case VERSION_3_4_BIT: switch((int)compression) { case BI_RGB: read4Bit(bdata); break; case BI_RLE4: readRLE4(bdata); break; default: throw new RuntimeException(I18N.getString("BMPImageReader1")); } break; case VERSION_3_8_BIT: switch((int)compression) { case BI_RGB: read8Bit(bdata); break; case BI_RLE8: readRLE8(bdata); break; default: throw new RuntimeException(I18N.getString("BMPImageReader1")); } break; case VERSION_3_24_BIT: // 24-bit images are not compressed read24Bit(bdata); break; case VERSION_3_NT_16_BIT: read16Bit(sdata); break; case VERSION_3_NT_32_BIT: read32Bit(idata); break; case VERSION_3_XP_EMBEDDED: case VERSION_4_XP_EMBEDDED: case VERSION_5_XP_EMBEDDED: bi = readEmbedded((int)compression, bi, param); break; case VERSION_4_1_BIT: read1Bit(bdata); break; case VERSION_4_4_BIT: switch((int)compression) { case BI_RGB: read4Bit(bdata); break; case BI_RLE4: readRLE4(bdata); break; default: throw new RuntimeException(I18N.getString("BMPImageReader1")); } case VERSION_4_8_BIT: switch((int)compression) { case BI_RGB: read8Bit(bdata); break; case BI_RLE8: readRLE8(bdata); break; default: throw new RuntimeException(I18N.getString("BMPImageReader1")); } break; case VERSION_4_16_BIT: read16Bit(sdata); break; case VERSION_4_24_BIT: read24Bit(bdata); break; case VERSION_4_32_BIT: read32Bit(idata); break; } if (abortRequested()) processReadAborted(); else processImageComplete(); return bi; }
当然这里还有对gif,jpg,bmp等常用图片的解析,有兴趣的可以去看下。
发表评论
-
对字符串进行验证之前先进行规范化
2013-09-17 23:18 13947对字符串进行验证之前先进行规范化 应用系统中经常对字 ... -
使用telnet连接到基于spring的应用上执行容器中的bean的任意方法
2013-08-08 09:17 1471使用telnet连接到基于spring的应用上执行容器中 ... -
jdk7和8的一些新特性介绍
2013-07-06 16:07 10110更多ppt内容请查看:htt ... -
java对于接口和抽象类的代理实现,不需要有具体实现类
2013-06-12 09:50 2952原文链接:http://www.javaarch.net/j ... -
Java EE 7中对WebSocket 1.0的支持
2013-06-05 09:27 3837原文链接:http://www.javaarch.n ... -
Java Web使用swfobject调用flex图表
2013-05-28 19:05 1121Java Web使用swfobject调用 ... -
spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
2013-05-21 15:57 3332spring使用PropertyPlaceholderCon ... -
java国际化
2013-05-20 20:57 4472java国际化 本文来自:http://www.j ... -
RSS feeds with Java
2013-05-20 20:52 1214RSS feeds with Java 原文来自:htt ... -
使用ibatis将数据库从oracle迁移到mysql的几个修改点
2013-04-29 10:40 1674我们项目在公司的大战略下需要从oracle ... -
线上机器jvm dump分析脚本
2013-04-19 10:48 2905#!/bin/sh DUMP_PIDS=`p ... -
eclipse远程部署,静态文件实时同步插件
2013-04-06 20:18 5460eclipse 远程文件实时同步,eclipse远程 ... -
java价格处理的一个问题
2013-03-26 21:21 1829我们经常会处理一些价格,比如从运营上传的文件中将某 ... -
java 服务降级开关设计思路
2013-03-23 16:35 3764java 服务屏蔽开关系统,可以手工降级服务,关闭服 ... -
poi解析excel内存溢出
2013-03-20 22:21 6397真是悲剧啊,一个破内部使用系统20多个人使用的后 ... -
简单web安全框架
2013-03-16 11:56 1543web安全框架,主要用servlet filter方 ... -
基于servlet的简单的页面缓存框架
2013-03-11 19:27 1215基于servlet的页面级缓存框架的基本用法: 代码参考: ... -
Eclipse使用过程中出现java.lang.NoClassDefFoundError的解决方案
2013-02-01 17:22 1572如果jdk,classpath设置正确,突然在eclipse ... -
jetty对于包的加载顺序的处理
2013-01-28 22:58 41301.问题 今天在本地和测试环境用jet ... -
hsqldb源码分析系列6之事务处理
2013-01-20 15:20 1706在session的 public Result ...
相关推荐
javax.imageio.plugins.bmp 包含供内置 BMP 插件使用的公共类的包。 javax.imageio.plugins.jpeg 支持内置 JPEG 插件的类。 javax.imageio.spi 包含用于 reader、writer、transcoder 和流的插件接口以及一个运行时...
javax.imageio.plugins.bmp 包含供内置 BMP 插件使用的公共类的包。 javax.imageio.plugins.jpeg 支持内置 JPEG 插件的类。 javax.imageio.spi 包含用于 reader、writer、transcoder 和流的插件接口以及一个运行时...
1. "设计模式.bmp":这可能是一个包含设计模式整体概念或特定模式的类图图片。类图通常会展示类的属性、方法以及类与类之间的关系,比如继承、关联、依赖等,这对于理解代码结构非常有帮助。 2. "Context.java":...
javax.imageio.plugins.bmp 包含供内置 BMP 插件使用的公共类的包。 javax.imageio.plugins.jpeg 支持内置 JPEG 插件的类。 javax.imageio.spi 包含用于 reader、writer、transcoder 和流的插件接口以及一个运行时...
Image I/O是JAI的一个扩展,专注于图像输入输出,支持多种图像文件格式,例如JPEG、TIFF、PNG、BMP、GIF等,同时也支持流式处理,使得在处理大型图像时更加高效。`jai_imageio-1.1.jar`这个库包含了这些功能的实现,...
### Java判断题知识点详解 #### 1. Java程序中的起始类名称必须与存放该类的文件名相同。(正) **解析**:这是正确的。在Java中,包含`public`类的源文件名必须...以上是对给定文件中的Java判断题知识点的详细解析。
6. **分析结果**:测试完成后,通过BMP的API获取`Har`(HTTP Archive)文件,它包含了整个测试过程中所有的网络请求详细信息。`Har`是一个JSON格式的数据,可以进一步解析和分析。 7. **高级用法**:除了基本的网络...
【Android开发问题集锦第一期】包含了多个关于Android开发中常见问题的解答,这些问题涵盖了图像处理、内存管理、Java特性的支持以及系统组件的使用等多个方面。以下是对这些问题的详细解释: 1. **Bitmap如何保存...
本示例适用于需要在数据库中存储和检索二进制大对象(如图像)的应用场景。 #### 二、环境配置与准备工作 1. **MySQL 数据库**: 需要确保已经安装并正确配置了 MySQL 数据库。 2. **Java 开发环境**: 需要安装 JDK...
RMI在JDK 1.1中引入,它的出现极大地提升了Java在分布式应用开发中的地位。 #### EJB的种类及其作用 EJB分为三种主要类型:Entity Bean、Session Bean和Message-Driven Bean。 - **Entity Bean**:用于表示持久化...
- **历史原因**:`Hashtable`是Java早期版本中的一部分,而`HashMap`是在JDK 1.2中引入的,因此在新项目中更倾向于使用`HashMap`。 #### 2. 抽象类与接口的区别 - **多重继承**:接口可以被多个类实现(`...
### Java实现简易画图程序知识点解析 #### 一、项目背景与目标 - **项目名称**:简易绘图程序 - **开发目的**:作为Java课程的期末作业,旨在运用所学的GUI(图形用户界面)知识开发一个简易的绘图程序。 - **功能...
### Java术语解析 #### JDBC (Java DataBase Connectivity) JDBC 是 Java 数据库连接的简称,它是一种用于执行 SQL 语句的 Java API,可以为多种关系数据库提供统一访问,它由一组用 Java 编程语言编写的类和接口...
javax.imageio.plugins.bmp 包含供内置 BMP 插件使用的公共类的包。 javax.imageio.plugins.jpeg 支持内置 JPEG 插件的类。 javax.imageio.spi 包含用于 reader、writer、transcoder 和流的插件接口以及一个运行时...
支持墙纸格式: JPG 、 BMP 、 PNG 和 GIF ;铃声 (MP3 、 AAC 、 AAC+ 和 WMA) 。 接入技术 蓝牙 (class 1) ;四频 (850 , 900 , 1800 , 1900) ;支持 3G , 802.11b 和 802.11g 。----------------------------...
- **EntityBean**:主要用于持久化数据,代表数据库中的实体,分为CMP(Container Managed Persistence)和BMP(Bean Managed Persistence)两种类型。 以上内容总结了j2ee面试题中的一些关键知识点,希望对准备...
`char`类型在Java中占用16位,因此可以存储单个中文汉字,因为Unicode编码中大部分常用汉字位于BMP(基本多文种平面)内,占用16位。 ### 8. 计算效率 计算2乘以8最有效率的方法是左移位运算:`2 ,相当于数学上的...